commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
Calculate the date of Sysadmin day (last Friday of July) of any given year
echo 1 > /proc/sys/sunrpc/nfs_debug && tail -f /var/log/messages
to debug NFS issues.
this function will give you a status webpage code using curl.
echoprint identify your song, then return artist, song name and album name(release) in a JSON. jq parse it and mp3info set the data in your mp3 file.
of course it depends on:
You need to set the environment variable
You can use it with find, but probably will bypass the 120 request/minute of developer account key. So, use a sleep to do it.
find -name \*.mp3 | while read $f; do eval echo $(echoprint-codegen "$f" | jq ' ..metadata | "mp3info -a \"" + .artist + "\" -t \"" + .title + "\" -l \"" + .release + "\" \"" + .filename + "\"" ' ) | bash; sleep 1; done
Downloads a CRL file, determines the expiration time, and checks when it will expire
Change the scale to adjust number of decimal places
prefix the command with "time" to benchmark the computer (compare how long it takes to calculate 10000 digits of pi on various computers).
change the path where you are, when is executed, is usefule when you've got folders to classify something like a tags, you've got devel/dist, android/ios, etc. like:
You can change between devel/project folder to dist/project without leave project.
If somebody has a better idea to do that without replace command.
piped this to pbcopy (OSX only) you got a uuid in the pasteboard
bash brace expansion, sequence expression
Downloads this raw script https://github.com/git/git/blob/master/contrib/completion/git-completion.bash from Github, copies it to your home directory, autoloads it in ~/.bashrc and sources it.
just set macdst to the mac address of the system
you wish to wake up, the macsrc is optional but helps
use tcpreplay to broadcast or wireshark to view
Tested on Windows 8 w/SSH, Cygwin - it can be tricky to quote if you dont use the $(..) syntax to echo it back out
btrfs checksum errors console report.
Not better, but more lightweight (sed instead of perl).
Above command is reduced due to length restriction of less than 256 characters and entity encoding of "Save" command on this page. This is complete command (best without entity encoding):
echo -e '\x2Helo folks\t!\r' | sed "y/\x0\x1\x2\x3\x4\x5\x6\x7\x8\x9\xA\xB\xC\xD\xE\xF\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F\x20/␀␁␂␃␄␅␆␇␈␉␊␋␌␍␎␏␐␑␒␓␔␕␖␗␘␙␚␛␜␝␞␟␠/"
Using the $PIPESTATUS array you can get the results of a command in a sequence of commands piped together. The command above returns the result of grep -o "bob", which is exit result of 1 since no match was made.
Mac OSX friendly version of google function
Useful if you don't have at hand the ability to automatically create a booklet, but still want to.
F is the number of pages to print. It *must* be a multiple of 4; append extra blank pages if needed.
In evince, these are the steps to print it, adapted from https://help.gnome.org/users/evince/stable/duplex-npage.html.en :
1) Click File ▸ Print.
2) Choose the General tab.
Under Range, choose Pages.
Type the numbers of the pages in this order (this is what this one-liner does for you):
n, 1, 2, n-1, n-2, 3, 4, n-3, n-4, 5, 6, n-5, n-6, 7, 8, n-7, n-8, 9, 10, n-9, n-10, 11, 12, n-11...
...until you have typed n-number of pages.
3) Choose the Page Setup tab.
- Assuming a duplex printer:
Under Layout, in the Two-side menu, select Short Edge (Flip).
- If you can only print on one side, you have to print twice, one for the odd pages and one for the even pages.
In the Pages per side option, select 2.
In the Page ordering menu, select Left to right.
4) Click Print.