Skip to content

Instantly share code, notes, and snippets.

View decause's full-sized avatar

decause decause

View GitHub Profile
@ralphbean
ralphbean / list-all-repos.py
Created June 7, 2013 23:17
Script to list all repos for a github organization
#!/usr/bin/env python
""" Print all of the clone-urls for a GitHub organization.
It requires the pygithub3 module, which you can install like this::
$ sudo yum -y install python-virtualenv
$ mkdir scratch
$ cd scratch
$ virtualenv my-virtualenv
@rossdylan
rossdylan / onelinepyramid.py
Created May 20, 2013 19:24
oh dear lord, pyramid hello world example in one line
herp = (lambda clist: __import__('wsgiref.simple_server').simple_server.make_server('0.0.0.0', 8080, clist[-1].make_wsgi_app()).serve_forever())((lambda config: [config.add_route('hello', '/hello/{name}'), config.add_view(lambda request: __import__('pyramid.response').response.Response('Hello {0}'.format(request.matchdict['name'])), route_name="hello"), config])((lambda: __import__('pyramid.config').config.Configurator())()))
@toolness
toolness / badgebakery.py
Created April 6, 2013 14:59
Simple Python module for baking of badges, and retrieval of assertion URLs from baked badges.
"""
This small module makes it easy to bake PNG images with links to
Open Badge assertions. It also allows for easy retrieval of the link
from baked PNGs.
For more information on badge baking, see:
https://github.com/mozilla/openbadges/wiki/Badge-Baking
Note that this module requires the PyPNG module:
@ndarville
ndarville / business-models.md
Last active June 13, 2025 01:26
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@garnaat
garnaat / gist:2917662
Created June 12, 2012 13:55
Example using boto to create an IAM role and associate it with an EC2 instance
In [1]: policy = """{
...: "Statement":[{
...: "Effect":"Allow",
...: "Action":["s3:*"],
...: "Resource":["arn:aws:s3:::mybucket"]}]}"""
In [2]: import boto
In [4]: c = boto.connect_iam()
In [5]: instance_profile = c.create_instance_profile('myinstanceprofile')
In [6]: role = c.create_role('myrole')
In [7]: c.add_role_to_instance_profile('myinstanceprofile', 'myrole')
@garnaat
garnaat / firstlaunch.py
Created May 18, 2011 12:16
Simple example of creating your first instance in EC2
import boto.ec2
import os, time
# define region_name to be region you want to connect to
region_name = 'eu-west-1'
conn = boto.ec2.connect_to_region(region_name)
# First upload a public key to use for SSH'ing to instance. Use "ssh-keygen" to generate.
fp = open(os.path.expanduser('~/.ssh/mykey.pub'))
material = fp.read()