one ring to bind them, one line to find them

 code, hack, python, web  Comments Off on one ring to bind them, one line to find them
Dec 072012
one ring to bind them, one line to find them

I guess if you import enough libraries just about anything can be made into a one liner… if you have imported BeautifulSoup, re, requests, and sys, in python3 you can simply do: print(re.sub(r’^.*imgurl=([^&]+)&.*$’, r’\1′, str(BeautifulSoup(requests.get("http://images.google.com/search?num=50&hl=en&safe=off&site=&tbm=isch&source=hp&biw=1744&bih=1279&q=%s&oq=" % sys.argv[1]).text).find(href=re.compile("imgurl"))))) To find the first hit on a google image search with argv[1]. Google will probably change their URL images later today and it’ll stop working, but I wanted this for a random […]

…losing a half day of my life… and I’m running out of half days.

 dinosaur, perl, philosophy, security, web  Comments Off on …losing a half day of my life… and I’m running out of half days.
Jul 272012

This line did it: $ENV{‘PERL_LWP_SSL_VERIFY_HOSTNAME’} = 0; Net::Nessus::XMLRPC, which calls LWP::UserAgent, didn’t emit any hints why something that had been working for many months suddenly doesn’t when I am forced to port to a new system… same OS, how could it go wrong? Turns out LWP changed the default behavior that had been around forever – now it dies if a cert isn’t kompletely kosher.  Since virtually every Nessus install […]

jesus fuxing christ

 philosophy, tech, web  Comments Off on jesus fuxing christ
Jun 212012

Some tool at firefox, which I’ve started using more with more web dev (<3 firebug), decided it’d be a good idea to switch windows if you type in a URL that is already open.   Unbelievable that they think this is good UI practice (switching focus invisibly to another fucking monitor is progress?)  And having no option to delete this asinine feature? Thank god for addons – https://addons.mozilla.org/en-US/firefox/addon/switch-to-tab-no-more/ Programmers… lowest […]

restoring mysql tables….

 DB, perl, web  Comments Off on restoring mysql tables….
Mar 262012

Note to self… use this perl program+backup…. http://blog.tsheets.com/2008/tips-tricks/extract-a-single-table-from-a-mysqldump-file.html And since things break over time… the program.  Not mine, use at your own peril, etc… just don’t ask why I needed it…. extract_sql

and now… custom fields

 perl, web  Comments Off on and now… custom fields
Mar 202012

Useful little things.  Beat on that old perl script and added support… a few lines of code, a lot of beating my head against the wall, but I didn’t see any other perl solutions.

© 2012 trouble Suffusion theme by Sayontan Sinha