Skip to content

Instantly share code, notes, and snippets.

View decause's full-sized avatar

Remy DeCausemaker decause

View GitHub Profile
@decause
decause / color_loop.py
Created December 12, 2011 15:35 — forked from ralphbean/color_loop.py
Loop over all of teh colorz!
#!/usr/bin/env python
step = 8
# step = 1 # for finer resolution in the color-space
bitspan = lambda : range(0, 255, step)
def print_color(r, g, b):
print "%.2x%.2x%.2x" % (r, g, b)
# You could do this one way, by generating every single combination of red,
@decause
decause / webwatcher.py
Created March 22, 2012 01:33
Silly Scraper
import urllib2
import re
from BeautifulSoup import BeautifulSoup
"""
User inputs URL
User inputs email
User inputs keyword
User provides Frequency?
@decause
decause / coderwall_badge_markup.html
Created July 19, 2012 19:15 — forked from bguthrie/coderwall_badge_markup.html
An example of Coderwall badge integration.
<!-- Add these tags to the HEAD section of your page. -->
<link href="http://coderwall.com/stylesheets/jquery.coderwall.css" media="all" rel="stylesheet" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://coderwall.com/javascripts/jquery.coderwall.js"></script>
<!-- You also need to place a container where you'd like the Coderwall badges to render. -->
<section class="coderwall" data-coderwall-username="(your username)" data-coderwall-orientation="(vertical or horizontal)"></section>
@decause
decause / twilio_flask_remyd.py
Created July 28, 2012 15:22
Twilio Hello World that plays an mp3
from flask import Flask
from flask import render_template
import twilio.twiml
app = Flask(__name__)
@app.route("/")
def hello_world():
@decause
decause / home.html
Created July 28, 2012 21:43
catfacts home.html template
<!doctype html>
<title>CatFacts</title>
<body>
<pre>
(\_/)
( =(^Y^)=
____\_(m___m)_______
</pre>
{{ catfact }}
@decause
decause / Knowledge example
Created August 1, 2012 21:36 — forked from Qalthos/Knowledge example
Example code for using the newly emancipated Knowledge module
#!/usr/bin/env python2
from sqlalchemy import create_engine
from knowledge.model import Fact, Entity, DBSession, init_model, metadata
def inject_knowledge():
knowledge = DBSession
monster = Entity(u'Monster')
fairy = Entity(u'Fairy')
rjbean = Entity(u'rjbean')
monster[u'color'] = u'Green'
@decause
decause / gist:3613202
Created September 3, 2012 20:34 — forked from ryansb/flash_drive_autocopy.sh
Copy SJ's magic to flash drives
find /run/media/ryansb -maxdepth 1 -type d | sed 1d | while read line
do
echo "$line"
rm -r $line/*
cp -r /home/ryansb/IGIC/*.pdf $line
chmod 777 $line/*
umount $line
done
echo "Done!"
@decause
decause / awardbadge.py
Last active December 15, 2015 04:39
Example code for awarding a badge via the tahrir-api
from tahrir_api.dbapi import TahrirDatabase
db = TahrirDatabase('backend://badges:badgesareawesome@localhost/badges')
badge_id = 'fossbox'
person_email = 'person@email.com'
person_id = hash(person_email)
issued_on = None
@decause
decause / clone.sh
Created June 13, 2013 20:35
Python Script to clone all the repos in the Gittip organization. Just do: python list-all-repos.py > gittip.txt
while read p; do
git clone $p
done < gittiprepos.txt
@decause
decause / parseconfig.py
Created June 17, 2013 15:14
Dead simple example of using ConfigParser to pull values from a config file.
import ConfigParser
config = ConfigParser.ConfigParser()
config.read('config.ini')
CLIENT_ID = config.get('general', 'CLIENT_ID', 0)
CLIENT_SECRET = config.get('general', 'CLIENT_SECRET', 0)