Skip to content

Instantly share code, notes, and snippets.

View ayust's full-sized avatar

Amber Yust ayust

  • Google
  • Vancouver, BC
  • 04:33 (UTC -08:00)
View GitHub Profile
@ayust
ayust / .gitconfig
Created September 8, 2011 11:28 — forked from tekkub/gist:1203061
Git aliases to prune merged branches
[alias]
prunelocal = !sh -c 'git branch --merged | grep -v "^*" | xargs git branch -d'
pruneorigin = prune-remote origin
##################
# Helper aliases #
##################
# prune-remote <remote name>
@ayust
ayust / gist:1734518
Created February 4, 2012 02:20
An pseudo-implementation of "Subversion", via Git.
[alias]
checkout=clone
commit=commit -a && (push || reset HEAD~1)
branch=false
update=pull --squash -Sresolve
merge=merge --squash -Sresolve
add=add --intent-to-add
@ayust
ayust / bisect-merges.py
Created March 14, 2012 23:12
Git bisection across only mainline commits (a la git log --first-parent)
#!/usr/bin/env python
import json
import optparse
import os
import subprocess
import sys
def gitdir():
Python 2.6.7 (r267:88850, Dec 2 2011, 20:27:26)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a = -1
>>> b = -2
>>> hash(a) == hash(b)
True
>>> hash(a)
-2
>>> hash(b)
@ayust
ayust / gist:2360906
Created April 11, 2012 17:53
Re-center Stream in New G+ Theme
/*
Add this theme in Stylish or the like.
Set it for 'Pages on the domain plus.google.com'
*/
#contentPane > div {
text-align: center !important;
}
#contentPane > div > div > div {
class Command(object):
command_name = None
# ...
class FooCommand(Command):
command_name = "foo"
#!/bin/bash
trap "echo ' Batman!'; exit 0" SIGINT
while true; do echo -n Na; sleep 0.1; done
@ayust
ayust / ordering.py
Created July 7, 2012 04:22
A simple proof-of-concept for comment partial ordering
# Let us control the passage of time (magic!)
wall_time = 0
class Comment(object):
# Used for quick and dirty unique IDs.
# In a real system, the IDs probably wouldn't be
# this simple, but it doesn't matter what they are
# as long as they're unique.
_instance_counter = 0
@ayust
ayust / fluttermosh.sh
Created November 30, 2012 21:21
Wrapper for mosh that makes it work on systems where mosh doesn't seem to want to parse properly
#!/bin/bash
set -e
MOSH_IP="$(host -cIN "$1" | cut -d' ' -f4)"
MOSH_CONNECT_INFO="$(ssh -t "$1" -- "mosh-server" | grep "MOSH CONNECT" | tr -d '\r' | cut -d' ' -f3,4)"
read MOSH_PORT MOSH_KEY <<<"$MOSH_CONNECT_INFO"
MOSH_KEY="$MOSH_KEY" exec mosh-client "$MOSH_IP" "$MOSH_PORT"
"""Analyze a log of a text communication, looking for distinct discussions."""
from collections import Counter, deque
import re
import string
import sys
LINE_RE = re.compile(r"^(?P<timestamp>[\d:]+)\s"
r"<\W?(?P<nick>[\w|^`[\]]+)>\s"
r"(?P<message>.*)$")