tag: Python

Python Learning

16 Apr, 2014 - 7 minutes
Random Talk Meta Programming Ruby - Book Netflix - Chaos monkey/gortilla/kong Testing thing which randomly shuts down servers, racks and data centers. Jython - Python+Java Mainly used in admin and QA """ HereDoc - Here be documentation (note it’s three double quotes) Execution in the kingdom of nouns youtube.com/user/reactconf http://lambda-the-ultimate.org/ Eric Evans, Domain Driven Design.

Script to get HTTP Headers

2 Aug, 2013 - 1 minutes
The below script uses urllib2 to connect to the given URL(s) then prints out the HTTP headers. http-server-header.py #:/bin/python import urllib2, sys if len(sys.argv) == 1: print "Please feed me a URL...\n\n<3\n" sys.exit(0) for url in sys.argv[1:]: r = urllib2.urlopen(url) print 'URL: ' + url + '\n' + str(r.info()) An example of it working is shown below. From a “security through obscurity” view, you’d want to conceal your HTTP server information.

Frame rate independent movement in PyGame

19 Aug, 2009 - 1 minutes
To make sure that your game runs the same on all computers that can handle it. You will need to make sure that your actions are independent from the frame rate. To do this in python you can put this code above the game loop framerate = 60 #frames per second clock = pygame.time.Clock() and then at the end of your game loop put timepassed = clock.tick(framerate) This should help with makeing the game more playable ^_^ Hope this helps.