Posted by admin
Fri, 28 Jan 2011 12:31:00 GMT
ruby -e 'Dir.glob("*").each { |fn| File.rename(fn, fn.downcase) }'
Obviously this would work with method #upcase as well.
Credit goes to poster "Florian Gilcher", here:
http://www.eggheadcafe.com/software/aspnet/35719452/oneliner-for-lowercasing-files.aspx
Posted in Command line, Ruby | Tags filenames, lowercase | no comments | no trackbacks
Posted by admin
Wed, 28 Jul 2010 15:01:00 GMT
For some reason, the "-o" option is missing from netstat on OS X Snow Leopard (10.6.4, anyway), so if you need to know which processes are using a given port, try:
sudo lsof -i -P | grep 36364
Of course substitute your own port number (36364 is used by Skype, btw).
Posted in Command line | Tags command, grep, line, lsof, netstat, o, OS, port, process, using, X | no comments | no trackbacks
Posted by admin
Sun, 11 Jul 2010 15:01:00 GMT
chuck: http://chuck.cs.princeton.edu/
ngrep: http://ngrep.sourceforge.net/
Using chuck and ngrep, you can translate the ascii output of ngrep into midi sounds in real time by reading from a file with chuck which is being appended by ngrep:
sudo ngrep -d en1 '' > network
chuck listen.ck < network
listen.ck source:
// computer key input, with sound
KBHit kb;
// patch
Impulse i => BiQuad f => dac;
// set the filter’s pole radius
.99 => f.prad;
// set equal gain zeros
1 => f.eqzs;
// initialize float variable
0.0 => float v;
// set filter gain
.5 => f.gain;
// time-loop
while( true )
{
// wait on event
kb => now;
// generate impulse
1.0 => i.next;
// loop through 1 or more keys
while( kb.more() )
{
// set filter freq
kb.getchar() => int c;
if(c < 58) 58 %=> c;
if(c > 120) 120 %=> c;
c => Std.mtof => f.pfreq;
// print int value
<<< “ascii:”, c >>>;
}
}
Sounds a bit like a colorful geiger counter.
Maybe you can ngrep for something specific and learn to recognize the sound of it amongst other traffic.
Posted in Command line, Obscure | Tags ascii, audio, BEEP, bleep, blorp, boop, chuck, geiger, internet, listen, listening, monitoring, network, ngrep, to, traffic | no comments | no trackbacks
Posted by admin
Fri, 11 Jun 2010 17:42:00 GMT
ls -1 | sed 's/.[.]*$//'
Posted in Command line | Tags extensions, filenames, list, suffixes, without | no comments
Posted by admin
Sun, 02 May 2010 16:47:00 GMT
Fine, then, we'll use Perl. OUTTA THA WAY!!!!!
Remove pesky windows carriage returns:
perl -pi.bak -e 's/\r/\n/g;' ./thefile
Posted in Command line, Perl | Tags carriage, linebreaks, liner, M, one, perl, returns, windows | no comments
Posted by admin
Sun, 02 May 2010 14:12:00 GMT
Turn a list into quoted comma separated values for a perl array:
perl -i.bak -ne 's/^(.*?)\n$/\"$1\",/;print' ./list_of_bare_strings
Oh, but your list is just a bunch of filenames you copied from the output of 'ls' and you need them one-per-line:
printf "%s\n" $(>pasted_ls_output) < list_of_bare_strings
Posted in Command line, Perl | Tags liner, one, perl | no comments | no trackbacks