Skip to content

Instantly share code, notes, and snippets.

View phillco's full-sized avatar

Phil Cohen phillco

View GitHub Profile
@phillco
phillco / tab_color.fish
Last active August 29, 2015 13:56 — forked from wadey/iterm2.zsh
Functions to set iTerm2 tab color in fish
function tab_color --description "Sets the current tab color. Usage: tab_color <r> <g> <b>"
echo -ne "\033]6;1;bg;red;brightness;$argv[1]\a"
echo -ne "\033]6;1;bg;green;brightness;$argv[2]\a"
echo -ne "\033]6;1;bg;blue;brightness;$argv[3]\a"
end
function tab_nocolor --description "Resets the current tab color."
echo -ne "\033]6;1;bg;*;default\a"
end
@phillco
phillco / gist:6374639
Created August 29, 2013 05:52
Theming your Chrome dev tools, OSX
mkdir -p "~/Library/Application Support/Google/Chrome/Default/User StyleSheets/"
nano "~/Library/Application Support/Google/Chrome/Default/User StyleSheets/Custom.css"
<paste in theme from http://devthemez.com/themes/chrome-developer-tools>
@phillco
phillco / install-django
Created August 11, 2013 21:51
Installs pip and django
#/bin/sh
curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
sudo python get-pip.py
sudo pip install django
@phillco
phillco / StepDown.cs
Created July 5, 2012 20:22
Replica set step down example
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MongoDB.Driver;
using MongoDB.Bson;
namespace MongoStepDown
{
class Program
@phillco
phillco / strassenExample.groovy
Created February 7, 2012 04:34
Example step-through of Strassen's method for matrix multiplication on 2x2 matrices
/* MULTIPLIES A and B =============
using Strassen's O(n^2.81) method
A = [1 3] B = [6 8]
[7 5] [4 2]
C = A * B = ?
=================================*/
// Step 1: Split A and B into half-sized matrices of size 1x1 (scalars).
@phillco
phillco / maxSubarray.groovy
Created February 6, 2012 21:42
Maximum subarray algorithm
/**
* Uses a smart, O(n) function to find the maximum subarray.
*/
def find_max_subarray_smart( array ) {
int max, max_start, max_end, start, tentative = 0;
for ( int i = 0; i < array.size(); i++ ) {
tentative += array[i];