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 […]
web
…losing a half day of my life… and I’m running out of half days.
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
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 […]
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 Attachments extract_sql (ERROR)
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. [attachments] Attachments wordpress-upload-post (ERROR)