Skip to content

Instantly share code, notes, and snippets.

@sit
sit / gitproxy-socat
Created January 20, 2009 02:30
A simple wrapper around socat to use as a git proxy command
#!/bin/sh
# Use socat to proxy git through an HTTP CONNECT firewall.
# Useful if you are trying to clone git:// from inside a company.
# Requires that the proxy allows CONNECT to port 9418.
#
# Save this file as gitproxy somewhere in your path (e.g., ~/bin) and then run
# chmod +x gitproxy
# git config --global core.gitproxy gitproxy
#
# More details at http://tinyurl.com/8xvpny
@mowen
mowen / org-style.css
Created March 9, 2010 12:19
A stylesheet for the Emacs Org Mode HTML export
/**
* This stylesheet will work pretty well with a regular Org Mode HTML export.
* However, you do have to turn off all of the defaults:
*
* (setq org-export-html-style-include-scripts nil
* org-export-html-style-include-default nil)
*
* and insert a call to the stylesheet:
*
* (setq org-export-html-style
@zoul
zoul / OSStatus.m
Created October 19, 2010 08:21
Decode OSStatus error codes into strings.
NSString *NSStringFromOSStatus(OSStatus errCode)
{
if (errCode == noErr)
return @"noErr";
char message[5] = {0};
*(UInt32*) message = CFSwapInt32HostToBig(errCode);
return [NSString stringWithCString:message encoding:NSASCIIStringEncoding];
}
@didip
didip / tornado_cookie_secret_generator.py
Created February 12, 2011 17:20
Generates secure cookie secret for Tornado Web Framework
@kopischke
kopischke / markdown2evernote.rb
Created June 5, 2011 16:57
OS X service scripts
#!/usr/bin/env ruby -wKU
# Adapted from Brett Terpstra’s original “Markdown to Evernote” service (http://brettterpstra.com/a-better-os-x-system-service-for-evernote-notes-with-multimarkdown/)
# Martin Kopischke 2011 – License: Creative Commons Attribution Share-Alike (CC BY-SA) 3.0 Unported (http://creativecommons.org/licenses/by-sa/3.0/)
# Changes: – create only one Evernote note per (Multi)Markdown input passed (instead of one per line)
# – do not choke on shell escape characters (use Tempfile instead of shell pipe for osascript)
# – default to MultiMarkdown 3 executable (instead of MMD 2 Perl script)
# – make smart typography processing optional (set SMARTY to 'false' to bypass processing;
# note smart typography cannot be disabled in MMD 3.0 and 3.0.1
# – handle both smart typography processing scripts (ie. SmartyPants.pl)
@lrvick
lrvick / flask_geventwebsocket_example.py
Created September 1, 2011 07:17
Simple Websocket echo client/server with Flask and gevent / gevent-websocket
from geventwebsocket.handler import WebSocketHandler
from gevent.pywsgi import WSGIServer
from flask import Flask, request, render_template
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@zengjie
zengjie / tornado-plupload.py
Created September 20, 2011 02:39
plupload tornado backend demo
import tornado.web
import tornado.ioloop
import logging
import os.path
def clean_filename(filename):
i = filename.rfind(".")
if i != -1:
filename = filename[0:i] + filename[i:].lower()
@mxswd
mxswd / classdiagram.gv
Created September 21, 2011 01:13
Class Diagram / ERD Graphviz example. Compile with `dot -Tpdf diagram.gv > diagram.pdf`
digraph models_diagram {
graph[overlap=false, splines=true]
"Venue" [shape=record, label="{\
Venue|name :string\l\
}"]
"User" [shape=record, label="{User|\
email :string\l\
password :string\l\
}"]
@scottjad
scottjad / Rakefile.diff
Created September 27, 2011 06:59
Octopress Rakefile changes to support org-mode
@@ -20,9 +20,10 @@ blog_index_dir = 'source' # directory for your blog's index pa
deploy_dir = "_deploy" # deploy directory (for Github pages deployment)
stash_dir = "_stash" # directory to stash posts for speedy generation
posts_dir = "_posts" # directory for blog files
+org_posts_dir = "org_posts"
themes_dir = ".themes" # directory for blog files
-new_post_ext = "markdown" # default new post file extension when using the new_p
-new_page_ext = "markdown" # default new page file extension when using the new_p
+new_post_ext = "org" # default new post file extension when using the new_post t
+new_page_ext = "org" # default new page file extension when using the new_page t
@st63jun
st63jun / pychecker.rb
Created September 30, 2011 09:56
Homebrew formula: pychecker
require 'formula'
class Pychecker < Formula
url 'http://downloads.sourceforge.net/project/pychecker/pychecker/0.8.19/pychecker-0.8.19.tar.gz'
homepage 'http://pychecker.sourceforge.net/'
md5 'c37182863dfb09209d6ba4f38fce9d2b'
def install
system "python", "setup.py", "install",
"--prefix=#{prefix}",