Skip to content

Instantly share code, notes, and snippets.

  • e675f89...a7822d3 master -> master (forced update)
  1. Create a local branch where master belongs.

    git checkout -b fixmaster e675f89

a. If someone pushed to master between the last time you pulled and now you'll need to go to github to get the full hash. Go to https://github.com/<owner>/<repo>/commit/e675f89 and it'll have the full hash on the page.

`git fetch origin <full hash of e675f89>`

git checkout -b fixmaster e675f89

@bretthoerner
bretthoerner / ipdb.py
Created August 4, 2011 18:21
ipdb for IPython 0.11
import sys
from IPython.core.debugger import Pdb
from IPython.core import ipapi
def set_trace():
ip = ipapi.get()
def_colors = ip.colors
Pdb(def_colors).set_trace(sys._getframe().f_back)
@mattdeboard
mattdeboard / .bash_profile
Created November 16, 2015 20:06 — forked from fieg/.bash_profile
.bash_profile for OSX including autocomplete for ssh hosts, default variables and some aliases
_complete_ssh_hosts ()
{
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
comp_ssh_hosts=`cat ~/.ssh/known_hosts | \
cut -f 1 -d ' ' | \
sed -e s/,.*//g | \
grep -v ^# | \
uniq | \
grep -v "\[" ;
#!/usr/bin/env python
from collections import defaultdict
def calc_probabilities(s="the cat in the hat"):
"""Calculate the probabilities (read: frequencies) of letters in
string `s`.
"""
#!/bin/bash
# You can run this to make fetch automatically prune any time you pull or
# fetch.
#
# git config remote.origin.prune true
git fetch --prune
# Abort early if there are local changes
git checkout master || exit
@pjenvey
pjenvey / gist:3808830
Created October 1, 2012 00:38
JSON Serializable SQLAlchemy Object
class JsonSerializableMixin(object):
def __json__(self, request):
"""
Converts all the properties of the object into a dict for use in json.
You can define the following in your class
_json_eager_load :
list of which child classes need to be eagerly loaded. This applies
to one-to-many relationships defined in SQLAlchemy classes.
@nanvel
nanvel / s3.py
Created July 24, 2015 14:56
Async s3 uploader for tornado
"""
Async Tornado S3 uploader with AWS4 sign.
https://gist.github.com/stalkerg/63bad3ea49be6268df49
Edited by @nanvel 2015-07-24
Usage example:
.. code-block:: python
@mattdeboard
mattdeboard / num_to_string.py
Last active March 2, 2020 18:10
Turns abitrary number into its string representation (e.g. 100 -> "one hundred") up to 999,999,999,999,999,999,999,999,999,999,999,999,999
#!/usr/bin/env python
from math import ceil, floor, log10
ones = {
1: 'one',
2: 'two',
3: 'three',
4: 'four',
5: 'five',
@mattdeboard
mattdeboard / central ac cycle.md
Last active October 11, 2020 00:54
Central AC system description

System Component Inputs & Outputs

Refrigerant Cycle

Evaporator

Composed of evaporator coils & refrigerant line.

Refrigerant passing through coils absorbs thermal energy from unconditioned air, resulting in cooler & drier air. This air is discharged into the living space.

  • Input: Low-pressure, low-temp liquid/vapor-mix coolant.
    • From: TXV
  • Output: Low-pressure, low-temperator coolant vapor.
@kaizhu256
kaizhu256 / gist:4482069
Last active October 20, 2021 16:25
javascript - very fast and simple uuid4 generator benchmarked on http://jsperf.com/uuid4/8
/*jslint bitwise: true, indent: 2, nomen: true, regexp: true, stupid: true*/
(function () {
'use strict';
var exports = {};
exports.uuid4 = function () {
//// return uuid of form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
var uuid = '', ii;
for (ii = 0; ii < 32; ii += 1) {