Quantcast
Channel: BSDnexus
Browsing latest articles
Browse All 17 View Live

Parse JSON on the CLI

Simple one-liner to parse JSON on the command line: 1 cat fileof.json | python -mjson.tool

View Article


PostgreSQL CSV output from the CLI

Get CSV output from a postgreSQL database directly from the CLI: 1 psql -A -F ',' -t -c 'select * from tablename;' You can then, clearly, redirect the output as desired.

View Article


Pipe filenames to tar

Simple oneliner that demonstrates the principle of how to specify the files you wish tar to archive (or extract) by piping to it: cat filenames.txt | tar cvzf ~/try.tgz -T -

View Article

gpg-agent pinentry

Sometimes, the default setting of the gpg-agent is to use the gtk version of the pinentry program, however this may not be desirable on headless servers. It is possible to alter this behaviour by...

View Article

open_basedir restriction in effect

PHP threw up this error today PHP Warning: Unknown: open_basedir restriction in effect. File(/foo/index.php) is not within the allowed path(s): (/bar/:/tmp/:/usr/share/pear/) Seems open_basedir is set...

View Article


gpg quick guide

GENERATE KEY PAIR Generate personal key pair (private and public) gpg --gen-key You will be prompted for a password for private key LISTING / VIEWING KEYS IN KEYRING List public keys in your gpg...

View Article

roundcube doesn’t display dates

Roundcube has a known issue where date fields are blank. Apparently it requires a timezone directive set, in /etc/php.ini add/edit this line: date.timezone = "US/Hawaii" You can change “US/Hawaii” with...

View Article

recursion power of

A book I was reading suggested I write a recursive function that calculated a power of a number. Here’s my attempt – comments and suggestions welcome: double powerup( double num, double powr) { if (...

View Article


udev interface naming

Following a hardware failure on a Ubuntu box, it seems that simply swapping the disk to a similar hardware system is not as easy as I had thought. It would appear that udev attempts to keep a permanant...

View Article


implementing my own strdup

While chatting on IRC last night I entered conversation about strdup(), a C function I had never used or encountered. I was then challenged to write my own. Checking the man page had me thinking about...

View Article
Browsing latest articles
Browse All 17 View Live