Skip to content

Instantly share code, notes, and snippets.

@guilhermechapiewski
guilhermechapiewski / mysql_to_omnigraffle.applescript
Created September 27, 2010 18:23
AppleScript to dump MySQL tables to OmniGraffle Pro.
(*
Copyright (c) 2008, Christian Mittendorf <christian.mittendorf@googlemail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this
list ofconditions and the following disclaimer. Redistributions in binary form
must reproduce the above copyright notice, this list of conditions and the
@mvasilkov
mvasilkov / gfm.py
Created November 22, 2010 21:11 — forked from christian-oudard/gfm.py
import re
from hashlib import md5
def gfm(text):
# Extract pre blocks.
extractions = {}
def pre_extraction_callback(matchobj):
digest = md5(matchobj.group(0)).hexdigest()
extractions[digest] = matchobj.group(0)
return "{gfm-extraction-%s}" % digest
@snay2
snay2 / watermark.py
Created March 18, 2011 17:00
How to apply a semi-transparent watermark to an image using Python
from PIL import Image, ImageDraw
def main():
# Open the original image
main = Image.open("12voltm.jpg")
# Create a new image for the watermark with an alpha layer (RGBA)
# the same size as the original image
watermark = Image.new("RGBA", main.size)
# Get an ImageDraw object so we can draw on the image
@denik
denik / ServerRack.py
Created June 5, 2011 09:31
class for managing multiple servers in gevent
# Class for managing multiple servers or anything with start() and stop() methods
class ServerRack(object):
def __init__(self, servers):
self.servers = servers
def start(self):
started = []
try:
@milkypostman
milkypostman / package.el
Created September 12, 2011 16:11
Function to update all packages in package.el
(defun package-update-all ()
"Update all packages"
(interactive)
(dolist (elt package-alist)
(let* ((name (car elt))
(file-name (symbol-name name))
(available-pkg (assq name package-archive-contents))
(available-version (and available-pkg
(package-desc-vers (cdr available-pkg))))
(current-version (package-desc-vers (cdr elt)))
@iloveitaly
iloveitaly / mysql2graffle.py
Created December 16, 2011 16:36
Visual Representation of MySQL Table in OmniGraffle
#! /usr/bin/pythonw
#
# Modified by Michael Bianco <info@cliffsidedev.com> on June 26, 2009
# Written by Thomas Pan at January 21, 2007
# mysql2graffle for Omnigraffle 5 is based on
# MyDBGraffle for OmniGraffle 4 which is based on Paul Davis' work at http://www.visualdistortion.org
#
# Requires:
#
# OmniGraffle 5
@sanchitgangwar
sanchitgangwar / snake.py
Created March 22, 2012 12:38
Snakes Game using Python
# SNAKES GAME
# Use ARROW KEYS to play, SPACE BAR for pausing/resuming and Esc Key for exiting
import curses
from curses import KEY_RIGHT, KEY_LEFT, KEY_UP, KEY_DOWN
from random import randint
curses.initscr()
win = curses.newwin(20, 60, 0, 0)
@peccu
peccu / common.css
Created May 20, 2012 04:43 — forked from takumikinjo/.gitignore
HTML5 Presentation export for Org-mode
#speaker-note {
position:absolute;
left: 0;
top: 80%;
width: 100%;
height: 20%;
z-index: 8;
opacity: 0.75;
background-color: white;
overflow: auto;
@leoncamel
leoncamel / gist:2943625
Created June 17, 2012 06:04
my brew installation list
#!/bin/sh
# GNU coreutils
brew install coreutils
brew install findutils
brew install binutils
brew install patchutils
# gdb & gcc
brew install gdb
@UniIsland
UniIsland / SimpleHTTPServerWithUpload.py
Created August 14, 2012 04:01
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""