Skip to content

Instantly share code, notes, and snippets.

View naupaka's full-sized avatar

Naupaka Zimmerman naupaka

View GitHub Profile
@MicahElliott
MicahElliott / colortrans.py
Created November 29, 2010 07:57
Convert values between RGB hex codes and xterm-256 color codes.
#! /usr/bin/env python
""" Convert values between RGB hex codes and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resources:
* http://en.wikipedia.org/wiki/8-bit_color
* http://en.wikipedia.org/wiki/ANSI_escape_code
@dsparks
dsparks / CorrelationEllipses.R
Created February 9, 2011 19:39
correlation plots with ellipses
# Correlation ellipses
doInstall <- TRUE # Change to FALSE if you don't want packages installed.
toInstall <- c("ellipse")
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
# Function to plot colored correlation ellipses
correlationEllipses <- function(cor){
require(ellipse)
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 24, 2024 17:56
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@moklett
moklett / openconnect.md
Created July 24, 2012 15:21
OpenConnect VPN on Mac OS X

Unfortunately, the Cisco AnyConnect client for Mac conflicts with Pow. And by "conflicts", I mean it causes a grey-screen-of-death kernel panic anytime you connect to the VPN and Pow is installed.

As an alternative, there is OpenConnect, a command-line client for Cisco's AnyConnect SSL VPN.

Here's how to get it set up on Mac OS X:

  1. OpenConnect can be installed via homebrew:

     brew update
    

brew install openconnect

@schmurfy
schmurfy / gist:3199254
Created July 29, 2012 14:33
Install pandoc Mac OS X 10.8
# Install MacTex: http://mirror.ctan.org/systems/mac/mactex/mactex-basic.pkg
$ sudo chown -R `whoami` /usr/local/texlive
$ tlmgr update --self
$ tlmgr install ucs
$ tlmgr install etoolbox
# Install pandoc view homebrew
@stephenturner
stephenturner / arrange_ggplot2.R
Created September 14, 2012 21:30
Arrange ggplot2 plots
## Function for arranging ggplots. use png(); arrange(p1, p2, ncol=1); dev.off() to save.
require(grid)
vp.layout <- function(x, y) viewport(layout.pos.row=x, layout.pos.col=y)
arrange_ggplot2 <- function(..., nrow=NULL, ncol=NULL, as.table=FALSE) {
dots <- list(...)
n <- length(dots)
if(is.null(nrow) & is.null(ncol)) { nrow = floor(n/2) ; ncol = ceiling(n/nrow)}
if(is.null(nrow)) { nrow = ceiling(n/ncol)}
if(is.null(ncol)) { ncol = ceiling(n/nrow)}
## NOTE see n2mfrow in grDevices for possible alternative
@davidbeckingsale
davidbeckingsale / md-to-of.rb
Last active February 9, 2016 22:50
Uses Brett Terpstra's `otask` app to create OmniFocus tasks from a Markdown list.
#!/usr/bin/env ruby
File.foreach(ARGV[0]) do |task|
# Remove the *
the_task = task.gsub(/\*/, '') if task.include? '*'
# Remove trailing newline
the_task = the_task.strip
# Use Brett Terpstra's otask to add the task to OmniFocus inbox
`/Users/david/Applications/OTask/bin/otask -s "#{the_task}"`
end
@dsparks
dsparks / periodic_regions.R
Created October 10, 2012 16:13
Adding regions to the background of a ggplot
# Adding regions to the background of a ggplot
doInstall <- TRUE # Change to FALSE if you don't want packages installed.
toInstall <- c("foreign", "plyr", "ggplot2", "RColorBrewer")
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
# House DW-NOMINATE Data: http://voteview.org/dwnominate.asp
dwNominate <- read.dta("ftp://voteview.com/junkord/HL01111E21_PRES.DTA")
# Make a re-coded party variable
@dsparks
dsparks / tm_example.R
Created December 11, 2012 16:43
Denver debate analysis I
rm(list = ls())
doInstall <- TRUE # Change to FALSE if you don't want packages installed.
toInstall <- c("zoo", "tm", "ggplot2", "Snowball")
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
# From: http://www.cnn.com/2012/10/03/politics/debate-transcript/index.html
Transcript <- readLines("https://raw.github.com/dsparks/Test_image/master/Denver_Debate_Transcript.txt")
head(Transcript, 20)
@0sn
0sn / build_rt.py
Created April 15, 2013 16:59
A python script to turn rescuetime data into something that Panic's StatusBoard app understands
#/usr/local/bin/python
"""Build Rescuetime Graph Data for StatusBoard.app
This script pulls data from a rescuetime account and flattens it into a format
that is easily read by StatusBoard. Okay. Run it with cron or launchd, whatever.
*nick wolfe
http://nameremoved.com/
"""