A blog, of sorts, intended as a place to experiment, struggle, question, and play with whatever research I am currently working on. The themes will thus change over time as my projects change, and the entries may be quotations that strike my fancy, attempts to puzzle through hairy problems, notes on sources, experiments, musings, dead ends, odd angles of looking at things. It is a voice to my frustrations, discoveries, curiosities, and confusions. It is thinking out loud. ...More 
bash, linux, scripts —
4 Jan 2008
I'm a terrible programmer, mainly because I only try to do it when I really need something, instead of just sequestering myself in a room with cheesy puffs and Dr. Pepper for 2 weeks to just do it already. So I find myself having to keep notes when I do anything successfully lest I forget when I need to program again 6 months later. Even the really, really simple shit. Sigh.
Changing file names quickly in a Linux directory with a billion files:
for i in $(ls -1 s_*.gif);
do (( n++ )); mv $i file$n.gif ;
done
Comments (0)
ktru, scripts, unix —
4 Aug 2007
I realized my last list cut out a huge swath of much older Top 35 lists, so I've modified my script slightly. It's still ugly and definitely not perfect, but, really, how much time do I have to play with perfecting this (don't ask)?
wget -w3 -r -l1 -IOLDLIST --no-parent http://bang.rice.edu/top35archive.shtml
rm test.txt; for i in * ; do sed -n '/op 35:/,$p' $i >> test.txt ; done
sed 's/<br>/%/g' test.txt | tr '%' 'backslashn' | tr "[:upper:]" "[:lower:]" | egrep -v "top 35" | sed -e 's/- /:: /g; s/ / / :: /g; s/ / :: /g' | egrep '::' | sed -e 's/^[0-9+] :: //g; s/^.[0-9] :: //g; s/^[0-9+]. //g; s/^.[0-9]. //g; s/^ //g' | sed -e :a -e '$!N;s/backslashn[^a-z0-9]/ /;ta' -e 'P;D' | tr -s " " | sed -e 's/<[a-z0-9 /"=]*>//g; s/^M//g; s/: ::/ ::/g;' | sort | uniq > top35.txt
Apologies if it comes out like crap or doesn't work for anyone. The special characters may or may not appear properly in the browser. If you run it and it doesn't work, give me a yell. Or, just look at the finished list.
Comments (0)
digital history, findability, hacks, relevance, scripts, search —
10 Jul 2007
Clever way to sift standard search results (ie google) against a known good result, thereby increasing relevance of final results.
Wonder if it would be possible to build front end to perform actions in one step - type in search, paste known good, hit go. Automatically calls script and performs actions in one swoop.
On Digital History Hacks, of course.
Comments (0)
ktru, scripts, unix —
7 Jul 2007
How to compile a single file of KTRU top 35 playlists for all time, in less than thirty minutes:
wget -O ktruraw.txt -w5 -r -l1 -IOLDLIST --no-parent http://bang.rice.edu/top35archive.shtml
sed '/<.*>/d' ktruraw.txt | egrep "(/|-| )" | sed 's/ - / :: /g' | sed 's/ / / :: /g' | sed 's/ / :: /g' | sed 's/^[^0-9]/1 :: &/g' | cut -d ":" -f3- | tr -s " " | tr "[:upper:]" "[:lower:]" | egrep "^ [a-z]" | sort | uniq > ktru-top35
Not perfect - some repeats where albums were entered with spelling or typing variations.
Comments (0)