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 - [Execution in the kingdom of nouns](http://steve-yegge.blogspot.co.uk/2006/03/execution-in-kingdom-of-nouns.html) - youtube.com/user/reactconf - http://lambda-the-ultimate.org/ - Eric Evans, Domain Driven Design. Build an unambiguous language - __lambda calculus__. What would happen if a formula was an input to a formula.

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.