brew install git bash-completion
Configure things:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
""" | |
Python serialization benchmark | |
Based on https://gist.github.com/marians/f1314446b8bf4d34e782 | |
2014-11-11 v1.0 | |
2014-11-12 v1.1 Added compression and output size. | |
""" | |
try: import cPickle | |
except: import pickle as cPickle # don't break in Python 3 | |
import json, marshal, pickle, random | |
from hashlib import md5 |
#!/usr/bin/perl | |
use Mysql; | |
use strict; | |
use vars qw($school_name); | |
use vars qw($pass); | |
require "./cgi-lib.pl"; |
import itertools | |
# Conway's Really Simple Game of Life based on "Stop Writing Classes" PyCon 2012 | |
def neighbors(point): | |
x,y = point | |
yield x + 1, y | |
yield x - 1, y | |
yield x, y + 1 | |
yield x, y - 1 |
import java.io.FileDescriptor; | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.io.OutputStream; | |
import java.io.PrintStream; | |
public class HelloWorld{ | |
private static HelloWorld instance; | |
public static void main(String[] args){ | |
instantiateHelloWorldMainClassAndRun(); |
""" | |
A simple proxy server. Usage: | |
http://hostname:port/p/(URL to be proxied, minus protocol) | |
For example: | |
http://localhost:8080/p/www.google.com | |
""" |
brew install git bash-completion
Configure things:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
Python syntax here : 2.7 - online REPL
Javascript ES6 via Babel transpilation - online REPL
import math
# -*- coding: utf-8 -*- | |
from bottle import route, run | |
@route('/') | |
def index(): | |
return '<h1>Hello World/h1>' | |
run(host='localhost', port=8000) |
#!/usr/bin/env bash | |
echo "Benchmark for Fibonacci numbers with Python3, Cython and PyPy" | |
echo ' | |
def fib(n): | |
"Return the n-th Fibonacci number." | |
i = 0 | |
a, b = 0, 1 | |
if n < 2: |
Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.
git revert {commit_id}'
Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32: