git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
So you've cloned somebody's repo from github, but now you want to fork it and contribute back. Never fear! | |
Technically, when you fork "origin" should be your fork and "upstream" should be the project you forked; however, if you're willing to break this convention then it's easy. | |
* Off the top of my head * | |
1. Fork their repo on Github | |
2. In your local, add a new remote to your fork; then fetch it, and push your changes up to it | |
git remote add my-fork git@github...my-fork.git |
# rectangle.pyx | |
cdef extern from "Rectangle.h" namespace "shapes": | |
cdef cppclass Rectangle: | |
Rectangle(int, int, int, int) | |
int x0, y0, x1, y1 | |
int getLength() | |
int getHeight() | |
int getArea() | |
void move(int, int) |
#!/usr/bin/env/python | |
# | |
# More of a reference of using jinaj2 without actual template files. | |
# This is great for a simple output transformation to standard out. | |
# | |
# Of course you will need to "sudo pip install jinja2" first! | |
# | |
# I like to refer to the following to remember how to use jinja2 :) | |
# http://jinja.pocoo.org/docs/templates/ | |
# |
#!/bin/sh | |
# Auto-reconnect ssh screen session after sleep + wifi network change | |
# usage: ssh-auto user@server | |
# With these setting SSH will detect a dropped connection after 30 seconds. | |
# Script will attempt to reconnect every 5 seconds whenever connection is dropped. | |
# Use Ctrl-C to exit the reconnect loop. | |
# choose your remote session manager | |
# ON_CONNECT_CMD='screen -DR' | |
ON_CONNECT_CMD='tmux -2 attach || tmux -2 new' |
#!/usr/bin/env python | |
""" | |
Produces load on all available CPU cores | |
""" | |
from multiprocessing import Pool | |
from multiprocessing import cpu_count | |
def f(x): | |
while True: |
#! /bin/bash | |
set -e | |
g++ -o test_offscreen.o -c test_offscreen.cpp -I$PYTHONHPC/include/vtk-6.0 | |
g++ -o test_offscreen test_offscreen.o $PYTHONHPC/lib/libvtk*.so | |
LD_LIBRARY_PATH=$PYTHONHPC/lib/ ./test_offscreen |
# -*- coding: utf-8 -*- | |
""" | |
Flask-Login example | |
=================== | |
This is a small application that provides a trivial demonstration of | |
Flask-Login, including remember me functionality. | |
:copyright: (C) 2011 by Matthew Frazier. | |
:license: MIT/X11, see LICENSE for more details. | |
""" |
import psycopg2 | |
import psycopg2.extensions | |
from select import select | |
from twisted.internet import threads | |
class AsyncNotify(): | |
""" | |
based on http://divillo.com/, adapted to newer psycopg version | |
Class to trigger a function via PostgreSQL NOTIFY messages. |
rabbitmqctl list_connections pid port state user vhost recv_cnt send_cnt send_pend name | awk '{print "rabbitmqctl close_connection \"" $1 "\" \"manually closing idle connection\"" | "/bin/bash" }' |