Sunday, July 8, 2012
Renaming large groups of files with find
My normal inclination is to use xargs coupled with find to do something batch-y like renaming groups of files across a whole directory tree, but I've had a lot of trouble getting the syntax perfect for using something like cp with xargs. It turns out that the find at the start of the chain has a -exec argument that allows multiple uses of the found file name no fuss no muss like xargs should. The command is:
find . -name "*.htm" -exec cp -p {} {}.original \;
The key seems to be in the \; at the end, which I guess that I wasn't doing right before.
Here the site that had the info that got me this breakthrough; it's in somebody's comments near the bottom:
http://csm.mech.utah.edu/content/2011/03/01/use-of-the-shell-xargs-command/
find . -name "*.htm" -exec cp -p {} {}.original \;
The key seems to be in the \; at the end, which I guess that I wasn't doing right before.
Here the site that had the info that got me this breakthrough; it's in somebody's comments near the bottom:
http://csm.mech.utah.edu/content/2011/03/01/use-of-the-shell-xargs-command/
Tuesday, June 26, 2012
Recent nice sed commands
Here are two nice sed calls that I did today:
To delete 6 lines out of every file that has a particular line in it:
grep -n "The number of passes was" | xargs -L1 -t sed -i -e '/The number of passes was/,+6d'
To delete all lines containing a match out of every file:
grep -n "$start_" | xargs -L1 -t sed -i -e '/\$start_/,+1d'
the -t in xargs is just to echo which files were altered to the screen, the -i in sed is modify in place (very handy), the +1 before the d in the second command was probably unneccesary.
To delete 6 lines out of every file that has a particular line in it:
grep -n "The number of passes was" | xargs -L1 -t sed -i -e '/The number of passes was/,+6d'
To delete all lines containing a match out of every file:
grep -n "$start_" | xargs -L1 -t sed -i -e '/\$start_/,+1d'
the -t in xargs is just to echo which files were altered to the screen, the -i in sed is modify in place (very handy), the +1 before the d in the second command was probably unneccesary.
Sunday, June 3, 2012
Refridgerator Filter
For our Whirlpool refrigerator, model # ED2KHAXVQ01, the replacement filter seems to be PUR 4396841, which at the moment we can still buy at Lowes. It's the two-port, "Fast Fill" type. The box additionally says "Replacement cartridge #P2RFWG2 for Filter Model # P2WG2L, P1WG2L, P2WG2 and P1WG2". The filter can be ordered online at www.whirlpool.com/accessories, no doubt if you can navigate a nighmarish selection maze of course.
Thursday, May 31, 2012
Are you shure virus
Extremely sad to see the signs of a redirect virus on gse12. Had a redirect from boingboing, when I cancelled it, got a popup that said "Do you want to leave this page -- Message from webpage -- are you shure". Getting a few google hits on it. This malware bytes page has a guy with a severe case being told unsucessfully to try to use TDSSkiller, he eventually does a reinstall:
http://forums.malwarebytes.org/index.php?showtopic=105033
Friday, May 4, 2012
A full-time source for the folding/stacking shelves
This site has the folding/stacking shelves that have appeared seasonally in my local stores.
http://www.homedecorators.com/detail.php?parentid=33232&aid=apads
It also has the awesome 14" skinny version, and many other good variations on "Mission" style shelving.
http://www.target.com/p/Mission-5-Shelf-Folding-Bookcase-Natural/-/A-13586160
This company is also resold by Amazon, findable when you search for "folding/stacking shelves", but turnaround seems faster and there are more shipping options when you order direct from homedecorators.com.
Thursday, April 12, 2012
GNU equivalent to MATLAB
Octave, or more completely Octave-forge, seems to be the free alternative to MATLAB. Since we can't buy another MATLAB license for our laptop, this was worth investigating.
Long story short, Octave can run MATLAB scripts without any modification, except for all the pieces in our code which make use of the "Fixed Point Toolbox". Octave has a Fixed Point Toolbox of its own, but it was written from scratch prior to MATLAB's and is not syntax compatible in any way.
As an aside, all the Fixed Point stuff seems universally to be used to model FPGA implementations, both in MATLAB and Octave. Makes sense.
So, if I wanted to completely rewrite our fixed point code, I could run Octave instead of MATLAB. It's almost worth it, but not quite.
Here's how to download binaries for Octave for Mac:
http://octave.org/wiki/index.php?title=Octave_for_Mac
Here's something short on the relatively minor compatibility issues between Octave and MATLAB (doesn't mention the fixed point toolbox):
http://www.csse.uwa.edu.au/~pk/research/matlabfns/octaveinfo.html
Here's something much longer on portability between MATLAB and Octave (doesn't mention the fixed-point toolbox, but a sidebar about MATLAB alone has a link to info on using MATALAB's toolbox):
http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB
Here is what seems to be the last word from the author of the Octave Fixed Point Toolbox himself, about why it's not getting any more support and why it's never going to be syntax compatible:
http://octave.1599824.n4.nabble.com/Fixed-point-arithmetic-td2284793.html
Lastly, what is with these "Free downloads" for Matlab for Mac? Given that you have to wait for a call back from Mathworks to get a trial version, not to mention their heinous price structure that has left many forum threads full of tears, how are these even out there? How likely are they to have the Fixed Point Toolbox anyhow?
http://mac.brothersoft.com/matlab.html
http://download.cnet.com/Matlab/3000-2053_4-2777.html
Long story short, Octave can run MATLAB scripts without any modification, except for all the pieces in our code which make use of the "Fixed Point Toolbox". Octave has a Fixed Point Toolbox of its own, but it was written from scratch prior to MATLAB's and is not syntax compatible in any way.
As an aside, all the Fixed Point stuff seems universally to be used to model FPGA implementations, both in MATLAB and Octave. Makes sense.
So, if I wanted to completely rewrite our fixed point code, I could run Octave instead of MATLAB. It's almost worth it, but not quite.
Here's how to download binaries for Octave for Mac:
http://octave.org/wiki/index.php?title=Octave_for_Mac
Here's something short on the relatively minor compatibility issues between Octave and MATLAB (doesn't mention the fixed point toolbox):
http://www.csse.uwa.edu.au/~pk/research/matlabfns/octaveinfo.html
Here's something much longer on portability between MATLAB and Octave (doesn't mention the fixed-point toolbox, but a sidebar about MATLAB alone has a link to info on using MATALAB's toolbox):
http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB
Here is what seems to be the last word from the author of the Octave Fixed Point Toolbox himself, about why it's not getting any more support and why it's never going to be syntax compatible:
http://octave.1599824.n4.nabble.com/Fixed-point-arithmetic-td2284793.html
Lastly, what is with these "Free downloads" for Matlab for Mac? Given that you have to wait for a call back from Mathworks to get a trial version, not to mention their heinous price structure that has left many forum threads full of tears, how are these even out there? How likely are they to have the Fixed Point Toolbox anyhow?
http://mac.brothersoft.com/matlab.html
http://download.cnet.com/Matlab/3000-2053_4-2777.html
Sunday, April 8, 2012
VI keymapping
Generally, all I tend to use this for is adding or removing comment characters to/from large blocks of code. The most recent example sequence for setting up the map is:
:map ~ 0i%j
Here is a link to the subject stuffed with extraneous info that I didn't need to remind me of how to do this:
http://vim.wikia.com/wiki/Mapping_keys_in_Vim_-_Tutorial_(Part_1)
:map ~ 0i%
Here is a link to the subject stuffed with extraneous info that I didn't need to remind me of how to do this:
http://vim.wikia.com/wiki/Mapping_keys_in_Vim_-_Tutorial_(Part_1)
Subscribe to:
Posts (Atom)