Malicious enjoyment derived from observing someone else’s misfortune
 

Tag Archives: _why

DNS for bash

Today, I decided I wanted a network service that propagated variables and aliases to every login shell that subscribed to it. This is dangerous on a large scale, but perfectly acceptable on my small home network where everyone trusts everyone else. First, I got Camping installed, bringing back fond memories of Ruby development. I then copied off the blog example, and created TreeHugger, a 427 line script that provides a web interface to edit the variables, and a plain text [...]

Sending Adblock Google Blockers Away

Of course I know that a simple Greasemonkey script can very easily thwart this, but I don’t expect most people to go out and find it to defeat this. If you don’t like my google ads, you can read this wonderful entry. function sendJerksAway() { // Bye eval(unescape("%69%66%28%24" + "%24%28%75%6e%65%73%63%61%70%65" + "%28%27%25%35%62%25%36" + "%65%25%36%31%25%36" + "%64%25%36%35%25%33" + "%64%25%36%37%25%36%66%25%36%66%25" + "%36%37%25%36%63%25%36%35%25" + "%35%66%25%36%31%25%36%34%25%37%33%25%35%66" + "%25%36%36%25%37%32%25" + "%36%31%25%36%64%25%36%35%25%35%64%27%29%29%2e%6c" + "%65%6e%67%74%68%20%3d%3d" + "%20%30%29%20%64%6f%63%75%6d%65%6e%74" + "%2e%6c%6f%63%61%74%69%6f" + "%6e%20%3d%20%22%68%74%74%70%3a" + "%2f%2f%67%6f%6f%67%6c%65%2e%62%6c%6f" + "%67%6e%65%77%73%63%68" + "%61%6e%6e%65%6c%2e%63%6f%6d" [...]

Processing: It’s totally not Flash

I’m not one to advocate Java generally, but Processing is totally hawt. Here’s something I screwed around with today: Ball[] myBalls; void setup() { size(500,500); frameRate(25); myBalls = new Ball[300]; for (int i = 0; i < 300; i++) { myBalls[i] = new Ball(); myBalls[i].x = random(0, 500); myBalls[i].y = random(0, 500); myBalls[i].r = random(0, 10); myBalls[i].xv = random(-5, 5); myBalls[i].yv = random(-5, 5); myBalls[i].mycolor = int(random(0, 100)); myBalls[i].myseed = int(random(25,100)); } } void draw() { background(0); for (int i [...]

_why thinks I’m a bike

I got featured on Redhanded. Apparently, I’m a bike. Probably because of my behavior under the name o`o in IRC. Sigh, it’s my only claim to fame. :(

Extending RedCloth

I wanted to put emoticons into Textile for Beast, but to do it, I needed to use very few lines of code since there is a 500LOC limit on Beast. After a long time debugging, here’s what I came up with: First, I made a new method in the RedCloth namespace. class RedCloth def refs_smiley(text) text.gsub!(/(\s)~(:P|:D|:O|:o|:S|:\||;\)|:’\(|:\)|:\()/) do |m| bef,ma = $~[1..2] filename = ActionController::AbstractRequest.relative_url_root+”/images/emoticons/”+(ma.split(//).collect{|l|l[0]}.join(‘_’))+”.png” “#{bef}<img src=’#{filename}’ title=’#{ma}’ class=’smiley’ />” end end end All I’m doing here is some nifty gsubbing [...]

DNS Mania

Well, I was stumbling today and found OpenDNS. I was excited to find that I could make it coexist with OpenNIC in my dhclient configuration. Here’s the resultant line that makes all this magic happen: prepend domain-name-servers 63.226.12.96, 208.67.222.222, 208.67.220.220; So now, when I use dhcp to grab an IP, I end up prepending these nameservers onto my resolv.conf. OpenDNS makes spam sites and domain squatters disappear. And it makes the average request a lot faster. Yesterday, bish0p and I [...]

TryRuby Alias (For Ruby Non-Believers)

Today, I decided I needed a quick way for my friends who run Linux to try ruby. Using _why’s awesome curl implementation of tryruby, here is the ultimate alias for any bashrc: alias tryruby=’sh -c “$(curl -s http://tryruby.hobix.com/try.sh)”‘

Parsing Amazon with Hpricot

_why made a really sweet HTML parser called Hpricot. This allows you to easily parse a remote document using Open-URI. Here’s how to do it: require ‘rubygems’ require_gem ‘hpricot’ require ‘open-uri’ puts "Grabbing Page…" html = open("http://www.amazon.com/gp/product/1844300439/ref=amb_cob_bh_194691301/002-0086113-2532879?n=283155") puts "Parsing…" doc = Hpricot.parse(html) (doc.search("//table//td[@id='prodImageCell']")/:img).each do |link| p link.attributes end {"src"=>"http://ec1.images-amazon.com/images/P/1844300439.01._AA240_SCLZZZZZZZ_V54614147_.jpg", "border"=>"0", "id"=>"prodImage", "height"=>"240", "alt"=>"Cobblers", "width"=>"240"} ruby -rrubygems -ropen-uri -e “require ‘hpricot’;(Hpricot.parse(open(‘http://www.amazon.com/gp/product/1844300439/ref=amb_cob_bh_194691301/002-0086113-2532879?n=283155′)).search(\”//table//td[@id='prodImageCell']\”)/:img).each {|link| p link.attributes }” Amazing stuff really. The parser is so amazingly fast. All the time is spent fetching the [...]

RubySig using Why’s Remote Require!

Using Why’s insane URI require stuff, I revised my sig by making a file called rubysig.txt on modzer0: $_=[1165125995,541553253,1734811772,543711598,1799381356,1634954081,778396789,545005639,1346849637,2033852464,2016687683,825700673,48];$/="";:c.id2name.hex.times{$/<<78.chr};$/<<99.chr;$\=$_.pack($/);puts$\ and calling it like this: ruby -ropen-uri -e ‘eval(open("http://modzer0.cs.uaf.edu/~hardwarehank/rubysig.txt").read)’ I just made a DNS redirect for the URL at sig.ralree.info so soon it will be this: ruby -ropen-uri -e ‘eval(open("http://sig.ralree.info").read)’ Yay for Why!

iPod Linux Journey Begins

Intro I wrote a HOWTO on compiling the iPod Linux Installer. Once I got it compiled, I could not get it to recognize my iPod, so I decided to do it by hand, which was very easy. I started with my 20GB 4th Generation iPod, which was had dead batteries for quite a while. I created a giant FAT32 Partition on it and formatted it, then I downloaded the latest iPod update software in Windows. I used the software to [...]