Skip to content

Instantly share code, notes, and snippets.

View hugs's full-sized avatar
🤖
Making robots

Jason Huggins hugs

🤖
Making robots
View GitHub Profile
@hugs
hugs / vncpasswd.py
Created February 15, 2009 02:46
vncpasswd - automated with python and pexpect
import sys
import pexpect
def setpassword(read_write_password, read_only_password=None):
p = pexpect.spawn("vncpasswd")
# Uncomment the next line if you want to see the standard output
#p.logfile = sys.stdout
if read_write_password:
print ("Setting read-write password")
@hugs
hugs / playing with phpsh + selenium rc
Created February 15, 2009 19:41
Using a PHP interactive prompt utility with Selenium RC makes it easier to debug Selenium tests.
* Download and open Selenium RC from seleniumhq.org
* Download and install phpsh from phpsh.org
[terminal-1$ sudo ln -s /home/ubuntu/Apps/phpsh/phpsh /usr/local/bin/phpsh
* Start Selenium RC Server (in a new terminal window)
[terminal-2]$ cd /home/ubuntu/Apps/selenium-remote-control-1.0-beta-2/
[terminal-2]$ cd selenium-server-1.0-beta-2/
[terminal-2]$ java -jar selenium-server.jar
@hugs
hugs / X-is-for-X-ray.txt
Last active August 30, 2015 00:25
26 "chapter" ideas for a children's book on the letter "X". X is for way more than "X-ray" and "xylophone"!
"X is for..."
1. Xerces Blue (a type of butterfly.) (I think this is the coolest of the X words, by the way.)
2. Xenosaur ("slender-bodied Mexican lizards." Love any word that ends in "osaur".) (Thanks, @amyrhoda!)
3. Xiphias (genus for swordfish)
4. X marks the spot (on a treasure map)
5. Xenon (thanks @trybka!)
6. Xi'an (Home of the Terracotta Army. Sweet.) (Thanks, @gvwilson!)
7. X Prize (This /is/ rocket science.)
8. Railroad crossing sign. (It's a visual: http://www.roadtrafficsigns.com/Crossing-Sign/Railroad-Crossing-Sign/SKU-X-W10-1.aspx)
@hugs
hugs / couchdb-delete-db-with-curl.txt
Created March 2, 2009 22:14
It's almost *too* easy.
$ curl http://localhost:5984/_all_dbs
["db-1","db-2","db-3"]
$ curl -X DELETE http://localhost:5984/db-3
{"ok":true}
$ curl http://localhost:5984/_all_dbs
["db-1","db-2"]
@hugs
hugs / Upload-file-to-s3-with-boto.py
Created May 17, 2009 19:41
Use the boto library to upload a file to S3
import boto
BUCKET = 'my-awesome-unique-bucket'
filepath = '/path/to/file/filename.zip'
conn = boto.connect_s3()
bucket = conn.lookup(BUCKET)
key = boto.s3.Key(bucket)
key.name = 'filename.zip'
key.set_contents_from_filename(filepath)
chipperfish:~ jasonhuggins$ sudo /Library/Frameworks/Python.framework/Versions/2.5/bin/easy_install Sphinx
Searching for Sphinx
Reading http://pypi.python.org/simple/Sphinx/
Reading http://sphinx.pocoo.org/
Best match: Sphinx 0.6.1
Downloading http://pypi.python.org/packages/2.5/S/Sphinx/Sphinx-0.6.1-py2.5.egg#md5=97b2b41115ba6825e5a9908b43cdf518
Processing Sphinx-0.6.1-py2.5.egg
creating /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Sphinx-0.6.1-py2.5.egg
Extracting Sphinx-0.6.1-py2.5.egg to /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages
Adding Sphinx 0.6.1 to easy-install.pth file
@hugs
hugs / the_day_i_will_die.py
Created July 3, 2009 18:53
Inspired by Kevin Kelly's "My Life Countdown" - in Python
# Inspired by: http://kk.org/ct2/2007/09/my-life-countdown-1.php
# Life expectancy data:
# http://www.health.state.ny.us/health_care/medicaid/publications/docs/adm/06adm-5att8.pdf
$ python
>>> from datetime import date, timedelta
>>> birth_year = 1976
>>> birth_date = date(1976,3,2)
>>> life_expectancy = 76.09
Terminal #1:
$ cd ~/selenium
# Download Selenium 1.0.1...
# If you don't have 'wget' installed, download and unzip manually
$ wget --quiet http://release.seleniumhq.org/selenium-remote-control/1.0.1/selenium-remote-control-1.0.1-dist.zip
$ unzip -q selenium-remote-control-1.0.1-dist.zip
$ cd selenium-remote-control-1.0.1/selenium-server-1.0.1/
# Environment:
# * Mac OS X: 10.4.11
# * Firefox: 3.5.1
# * Java: "1.5.0_19" (build 1.5.0_19-b02-306)
# * Ruby: 1.8.6 (2007-03-13 patchlevel 0) [universal-darwin8.0]
# * Selenium RC: 1.0.1
# * selenium-client gem: 1.2.16
# Terminal #1:
# ------------
@hugs
hugs / startup-crawl-addresses
Created November 21, 2009 03:46
Startup Crawl List of Addresses
1. Scribd, 539 Bryant St, Ste 200
2. Engine Yard, 500 3rd St., 5th Floor
3. Sauce Labs, 500 3rd St., 2nd Floor
4. SocialCast, 19 South Park St.
5. Plato's Forms, 300 Brannan St., Ste. 404
6. Shop It To Me, 340 Brannan St.
7. BigTent, 350 Brannan St.
8. Justin.tv, 36 Clyde St.
9. ZenDesk, 410 Townsend St.
10. Yammer, 410 Townsend St.