Skip to content

Instantly share code, notes, and snippets.

Avatar

Amit Upadhyay amitu

View GitHub Profile
@kogakure
kogakure / fabfile.py
Created Oct 17, 2009
Python: Fabric 0.9/1.x - Synchronize files with rsync
View fabfile.py
#!/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 Jun 16, 2011
How to access the Mac OS X Address Book from Python: <http://www.programmish.com/?p=26>
View print_contacts_from_address-book.py
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 Sep 12, 2011 — forked from alexander-yakushev/tetris.clj
Tetris implementation in Clojure
View tetris.clj
(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)
View gist:2597326

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@mrdoob
mrdoob / gist:3504382
Created Aug 28, 2012
Encoding png sequence + audio into a webm with good quality.
View gist:3504382
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 May 17, 2020
go-eventsource
View .gitignore
eventsource
go-eventsource
client/client
@simonw
simonw / gist:3947083
Created Oct 24, 2012
Setting up port forwarding from inside an SSH session
View gist:3947083
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 Oct 29, 2012
phpbuildout
View php.cfg
# ===================================================================
# 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 Dec 11, 2015
Because you should maintain API compatibility when you tell everyone to use your shit.
View fix_requests.py
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 Nov 25, 2020
Big list of http static server one-liners
View web-servers.md

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
You can’t perform that action at this time.