Skip to content

Instantly share code, notes, and snippets.

@brymck
brymck / gist:1816919
Created February 13, 2012 13:12
System configuration
#!/usr/bin/env ruby
=begin
To run, copy and paste the following command into a console:
ruby < <(curl -s https://raw.github.com/gist/1816919/469a4086833ce3b3496476aef1246c5d81b7ac99/gistfile1.rb)
And shucks, if that doesn't work, there's always this:
bash --version && \
brew --version && \
bundle --version && \
curl --version && \
@brymck
brymck / gist:1843229
Created February 16, 2012 08:17
Installing RVM, Ruby and .vim
# Install RVM
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )
# Tell bash (the terminal) to automatically load RVM, then tell bash to reload
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
source ~/.bash_profile
# Install the latest version of Ruby and set it as the default
rvm install 1.9.3
rvm use 1.9.3 --default
@brymck
brymck / konjac_env.sh
Created March 13, 2012 04:32
Getting Xcode to compile the latest Ruby
#!/bin/sh
#
# First install the latest Command Line Tools for Xcode package:
# https://developer.apple.com/downloads/index.action?name=command%20line%20tools%20for%20xcode
#
# You can then run this by either copying and pasting everything into a terminal or running:
# bash -s < <(curl -L https://raw.github.com/gist/2026768/konjac_env.sh)
#
# Install Homebrew
@brymck
brymck / battery_charge.zsh
Created July 10, 2012 13:52
zsh battery display for OS X
# A purely .zsh method inspired by Steve Losh's Python script for displaying battery power with zsh:
# http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/#my-right-prompt-battery-capacity
#
# For best results assign to RPROMPT
function battery_charge {
# Adjust to your preferred number of segments
typeset -i SEGMENTS
SEGMENTS=10
# Get maximum and current capacity as floats via ioreg
@brymck
brymck / hoge.tex
Created August 6, 2012 14:40
Bare minimum Japanese LaTeX skeleton
% bare minimum Japanese document for Mac
%
% build with:
% latexmk -pdf hoge.tex
\documentclass[11pt]{article}
\usepackage[top=0.5in, bottom=0.75in, left=0.75in, right=0.75in]{geometry}
\usepackage{xltxtra}
\XeTeXlinebreaklocale "ja"
\setmainfont[Mapping=tex-text]{Hiragino Mincho Pro W3}
@brymck
brymck / changeInput.sh
Created August 6, 2012 15:41
Assign input method to a keyboard shortcut in Mac
#!/bin/sh
# Run with
# curl -L https://raw.github.com/gist/3275691/changeInput.sh | sh
git clone git://gist.github.com/2146751.git changeInput
cd changeInput
gcc t.m -o changeInput -lobjc -framework foundation -framework carbon
cp changeInput ~/bin
# Then open Automator and create something like:
# Service
@brymck
brymck / flickr_set.rb
Created September 3, 2012 13:40
Download all photos from a set in Flickr
#!/usr/bin/env ruby
# To get a list of available albums:
# flickr_set.rb bryanmckelvey
#
# To download an album:
# flickr_set.rb bryanmckelvey "Fall 2011"
require "fleakr"
# Get an API key at http://www.flickr.com/services/apps/create/apply
@brymck
brymck / kill_java.bat
Created September 4, 2012 06:58
Kill off a Java process with better information than what Task Manager gives you
@echo off
rem List all running Java processes, excluding useless metrics
tasklist /fi "IMAGENAME eq javaw.exe" /fo LIST /v ^
| find /v "Session" ^
| find /v "User" ^
| find /v "CPU" ^
| find /v "Status"
echo.
:user_input
@brymck
brymck / color_cells.bas
Created September 20, 2012 08:41
Color all cell background and foreground indices
' For when you want to preserve color indices when saving from Excel 2007+ to
' .xls format. Copy into PERSONAL.XLS or your worksheet and run with
' Alt+F11, Ctrl+G, ColorCells()
Private Const StartRow As Integer = 2
Private Const StartCol As Integer = 2
Private Const LastColorIndex As Integer = 56
Public Sub ColorCells()
Dim i As Integer
@brymck
brymck / clojure_big_o.md
Created January 5, 2014 09:36
Clojure Big-O

Clojure Big-O

op hash-map sorted-map hash-set sorted-set vector queue list lazy seq
conj log32n log2n log32n log2n 1 1 1 1
assoc log32n log2n - - log32n - - -
dissoc log32n log2n - - - - - -
disj - - log32n log2n - - - -
nth - - - - log32n n n n
get log32n log2n log32