Skip to content

Instantly share code, notes, and snippets.

View amitu's full-sized avatar
😀
Building fastn.com

Amit Upadhyay amitu

😀
Building fastn.com
View GitHub Profile
@kogakure
kogakure / fabfile.py
Created October 17, 2009 14:20
Python: Fabric 0.9/1.x - Synchronize files with rsync
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Fabric 0.9/1.x – Synchronize files in a project folder with webserver
from fabric.api import env
from fabric.contrib.project import rsync_project
env.hosts = ['domain.com']
env.path = '/home/user/project/'
@pklaus
pklaus / print_contacts_from_address-book.py
Created June 16, 2011 18:24
How to access the Mac OS X Address Book from Python: <http://www.programmish.com/?p=26>
import objc
import AddressBook as ab
import pprint as pp
def pythonize(objc_obj):
if isinstance(objc_obj, objc.pyobjc_unicode):
return unicode(objc_obj)
elif isinstance(objc_obj, ab.NSDate):
return objc_obj.description()
@ghoseb
ghoseb / tetris.clj
Created September 12, 2011 08:09 — forked from alexander-yakushev/tetris.clj
Tetris implementation in Clojure
(ns tetris.core
(:import (java.awt Color Dimension BorderLayout)
(javax.swing JPanel JFrame JOptionPane JButton JLabel)
(java.awt.event KeyListener))
(:use clojure.contrib.import-static deflayout.core
clojure.contrib.swing-utils)
(:gen-class))
(import-static java.awt.event.KeyEvent VK_LEFT VK_RIGHT VK_DOWN VK_UP VK_SPACE)
@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@mrdoob
mrdoob / gist:3504382
Created August 28, 2012 21:09
Encoding png sequence + audio into a webm with good quality.
ffmpeg -r 24 -i sequence/%d.png -i audio.aif -g 120 -level 216 -profile 0 -qmax 42 -qmin 10 -rc_buf_aggressivity 0.95 -vb 2M video.webm
@artisonian
artisonian / .gitignore
Last active March 21, 2024 20:13
go-eventsource
eventsource
go-eventsource
client/client
@simonw
simonw / gist:3947083
Created October 24, 2012 16:19
Setting up port forwarding from inside an SSH session
localhost:~$ ssh example.com
ubuntu@example.com:~$
... ooh, I could really do with a port forwarding to something on here ...
Type ENTER TILDE CAPITAL-C
ssh>
Secret SSH shell!
ssh> -L8080:localhost:8080
@kingel
kingel / php.cfg
Created October 29, 2012 10:22
phpbuildout
# ===================================================================
# Builds PHP as an Apache module (Apache profile needed)
[buildout]
extends =
apache.cfg
mysql.cfg
# Buildout parts
parts +=
png-build
@dcramer
dcramer / fix_requests.py
Last active December 11, 2015 21:28
Because you should maintain API compatibility when you tell everyone to use your shit.
from requests.models import Response
class fixedjson(object):
def __init__(self, func):
self.func = func
def __get__(self, inst, cls):
result = self.func(inst)
class proxy(type(result)):
@willurd
willurd / web-servers.md
Last active April 23, 2024 23:07
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000