Check These Out
A common programming question for interviewers to ask potential job candidates is to code "FizzBuzz". That is, if a number is divisible by 3, then it should display "Fizz". If a number is divisible by 5, it should display "Buzz". If it is divisible by both, then it should display "FizzBuzz". Otherwise, display the current number between 1 and 100.
For fancier and cleaner output, try the following snippet :
$ showendlines(){ while read i; do od --address-radix=n --width=$(wc -c
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"
If you're like me and want to keep all your music rated, and you use xmms2, you might like this command.
I takes 10 random songs from your xmms2 library that don't have any rating, and adds them to your current playlist. You can then rate them in another xmms2 client that supports rating (I like kuechenstation).
I'm pretty sure there's a better way to do the grep ... | sed ... part, probably with awk, but I don't know awk, so I'd welcome any suggestions.
This command will disable the beep sound from the PC speaker.
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"
Replace 'csv_file.csv' with your filename.
When expanding, bash output the command, so don't be affraid if you type the command.
Here is the details:
First examples:
$echo foo bar foobar barfoo
First argument:
$echo !$
echo barfoo
barfoo
(Note that typing echo foo bar foobar barfoo && echo !$, bash substitute !$ with $:1)
Last argument:
$echo foo bar foobar barfoo && echo !^
echo foo bar foobar barfoo && echo barfoo
foo bar foobar barfoo
barfoo
All the arguments:
$echo !*
echo foo bar foobar barfoo
foo bar foobar barfoo
The third argument:
$echo foo bar foobar barfoo && echo !:3
echo foo bar foobar barfoo && echo foobar
foo bar foobar barfoo
foobar
You may want to add {} for large numbers: echo !:{11} for example
Now with path:
$echo /usr/bin/foobar
/usr/bin/foobar
For the head:
$echo !$:h
echo /usr/bin
/usr/bin
And the tail:
$echo !$:t
echo foobar
foobar
You also may want to try !:h and !:t or !!3-4 for the third and the fourth (so !!:* == !!:1-$)
A dear friend of mine asked me how do I copy a DVD to your hard drive? If you want to make a copy of the ISO image that was burned to a CD or DVD, insert that medium into your CD/DVD drive and (assuming /dev/cdrom is associated with your computer?s CD drive) type the following command