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
@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`";
@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
@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
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
""" 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"

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

$ ssh -L9418:github.com:9418 [email protected]

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