This attempts to be a useful "cheat sheet" for git. I'm just writing git recipes down here as I find and use them.
Clone a repository (GitHub)
git clone [email protected]:username/repository.git
| # | |
| # Monty Hall Problem Simulation | |
| # Author: Ryan Sturmer | |
| # | |
| import random | |
| def play_round(doors, switch): | |
| # Choose the location of the car |
| import base64 | |
| import os | |
| def convert(infile): | |
| with open(infile, 'rb') as fp: | |
| data = fp.read() | |
| b64 = base64.b64encode(data) | |
| with open("%s.htm" % os.path.splitext(infile)[0], 'w') as fp: |
| # Counting Squares Problem | |
| # Code derived from original script by Keith Brafford | |
| # | |
| import itertools | |
| coords = [(0,0), (1,0), (2,0), (3,0), (4,0), | |
| (1.5,.5), (2,.5), (2.5,.5), | |
| (0,1), (1,1),(1.5,1), (2,1), (2.5,1), (3,1), (4,1), | |
| (1.5,1.5), (2,1.5), (2.5,1.5), | |
| (0,2), (1,2), (2,2), (3,2), (4,2), |
| import sys, os, urllib, shutil | |
| from urlparse import urlparse | |
| from zipfile import ZipFile | |
| SDK_DIR = 'sdk' | |
| TMP_DIR = os.path.join(SDK_DIR, 'tmp') | |
| MOZILLA_SDK = 'https://ftp.mozilla.org/pub/mozilla.org/labs/jetpack/addon-sdk-1.9.zip' | |
| VOLD_UTILS = 'https://github.com/voldsoftware/vold-utils-jplib/zipball/master' | |
| VOLD_MENUITEMS = 'https://github.com/voldsoftware/menuitems-jplib/zipball/master' |
This attempts to be a useful "cheat sheet" for git. I'm just writing git recipes down here as I find and use them.
Clone a repository (GitHub)
git clone [email protected]:username/repository.git
| call pathogen#infect() | |
| set nocompatible | |
| set number | |
| source $VIMRUNTIME/vimrc_example.vim | |
| source $VIMRUNTIME/mswin.vim | |
| set diffexpr=MyDiff() | |
| function MyDiff() |
| #!/bin/sh | |
| # System Update | |
| pacman --noconfirm -Syu | |
| #The essentials | |
| pacman --noconfirm -S base-devel vim git | |
| # Packer (AUR Helper) | |
| cd /tmp |
| NOTES_SHARP = ["C", "C#", "D", "D#", "E", "F", "F#", "G","G#", "A","A#","B"] | |
| NOTES_FLAT = ["C", "Db", "D", "Eb", "E", "F", "Gb", "G","Ab", "A","Bb","B"] | |
| def generate_midi_event_map(): | |
| events = ['Note Off', | |
| 'Note On', | |
| 'Polyphonic Aftertouch', | |
| 'Control Mode Change', | |
| 'Program Change', | |
| 'Channel Aftertouch', |
| #!/usr/bin/env python | |
| #coding:utf-8 | |
| # Purpose: Export 3D objects, build of faces with 3 or 4 vertices, as ASCII or Binary STL file. | |
| # License: MIT License | |
| import struct | |
| ASCII_FACET = """facet normal 0 0 0 | |
| outer loop | |
| vertex {face[0][0]:.4f} {face[0][1]:.4f} {face[0][2]:.4f} |
| #!/bin/sh | |
| # This is a script for making a beaglebone SD card | |
| if [[ $EUID -ne 0 ]]; then | |
| echo "This script must be run as root" 1>&2 | |
| exit 1 | |
| fi | |
| read -p "This will obliterate the partition table on $1... Are you sure? (y/n)" -n 1 -r |