Skip to content

Instantly share code, notes, and snippets.

View rphillips's full-sized avatar

Ryan Phillips rphillips

  • Red Hat
  • Austin, TX
View GitHub Profile

Create a tunnel to github with the git default daemon port like this:

$ ssh -L9418:github.com:9418 myuser@myhomessh.com

And clone repositories replacing github.com with localhost, like so:

$ git clone git://localhost/someuser/someproject.git

If you want to preserve the “correct” metadata, there are several options

""" file mytest.py """
# you require to return a HttpResponse instance in your view
from django.http import HttpResponse
# handler* are required for the urlresolver
from django.conf.urls.defaults import patterns, handler404, handler500
# minimal settings
DEBUG = True
# tell django to use this file to find urlpatterns. see below
ROOT_URLCONF = "mytest"
def load_modules(path):
"""
Load all Python modules from a directory into a dict.
:param path: the path to the living place of the modules to load.
:type path: :class:`str`
:returns: map between loaded modules name and their content.
:rtype: :class:`dict`
"""
import os, imp
@swaroopch
swaroopch / flask-boilerplate-tmux.bash
Created December 5, 2010 07:00
A command that scripts a tmux session
#!/bin/bash
function flask-boilerplate-tmux
{
# https://github.com/swaroopch/flask-boilerplate
BASE="$HOME/code/flask-boilerplate"
cd $BASE
tmux start-server
tmux new-session -d -s flaskboilerplate -n model
@tvon
tvon / homebrew-macvim.sh
Created April 8, 2011 18:48
Use homebrew installation of macvim for terminal vim command.
if [ -x `which brew` ]; then
macvim_version=`brew list --versions macvim | sed 's/.* \([0-9\.\-]*\)$/\1/'`
if [ -n "${macvim_version}" ]; then
alias vim=`brew --prefix`/Cellar/macvim/${macvim_version}/MacVim.app/Contents/MacOS/Vim
fi
fi
@otterley
otterley / ssh_precopy.sh
Created May 12, 2011 17:34
ssh precopy bash script
# Those of you who frequently log in to different hosts and prefer your experience to be consistent may appreciate an "ssh precopy"
# function. The idea is that when you intend to ssh to a host, a set of files (usually dotfiles such as .profile, .gitconfig, etc.)
# that you designate is copied immediately before the actual remote login takes place.
# Simply include the function in your .profile on your "base station" (e.g., your laptop). Then edit $HOME/.briefcase; each line
# should contain a file (relative to $HOME) you want to copy.
# Store ssh(1)'s path.
__SSH="`type -path ssh 2>/dev/null`";
@jboner
jboner / latency.txt
Last active May 4, 2024 21:16
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@rjemanuele
rjemanuele / mwpc.txt
Last active August 4, 2019 04:45
Milky Way Pound cake
I've never made the frosting. It's too rich.
Use "PAM with flour" baking spray.
Milky Way Pound cake
6 (2.15 ounce) Milky Way Bars
1 cup butter, divided
2 cups sugar
4 eggs
@monokrome
monokrome / commands
Last active December 17, 2018 22:33
Some of my weechat settings
/key bind meta-ctrl-I /go
/key unbind ctrl-W
/key bind ctrl-Wl /window right
/key bind ctrl-Wh /window left
/key bind ctrl-Wj /window down
/key bind ctrl-Wk /window up
/key bind ctrl-Wmeta2-C /window right
-- updated for luvit 2
local ffi = require('ffi')
local bit = require('bit')
local uv = require('uv')
local timer = require('timer')
local Object = require('core').Object
local utils = require('utils')
local libcurl = ffi.load('libcurl')