Skip to content

Instantly share code, notes, and snippets.

@jrnewell
jrnewell / git-build-cygwin.txt
Last active August 29, 2015 14:07
Build a newer version of Git on Cygwin
Build a newer version of Git on Cygwin
1. Run the Cygwin setup utility and ensure you have the following packages installed:
- gcc
- autoconf
- curl
- libcurl-devel, required for http/https support (NOTE: this is an obsolete package, you will need to uncheck "Hide obsolete packages" when selecting packages to install)
- make
- libiconv
- python
@jrnewell
jrnewell / unity-launcher.bash
Created October 11, 2014 17:54
Launch unity programs with local environment variables
#!/bin/bash -i
source /home/james/.bashrc && exec "$@"
@jrnewell
jrnewell / purge-old-kernels.bash
Created October 11, 2014 17:55
Script to remove old linux kernels from Ubuntu
#!/bin/bash
sudo apt-get autoremove --purge $(dpkg -l 'linux-image-*' | \
sed '/^ii/!d;/'"$(uname -r | \
sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d')
exit $?
@jrnewell
jrnewell / update-pyenv.bash
Created October 11, 2014 17:57
Quickly update(pull) the .pyenv directory and plugins using 'git up'
#!/bin/bash
echo "updating .pyenv"
cd $HOME/.pyenv
git up
cd $HOME/.pyenv/plugins
for DIR in $(find . -maxdepth 1 -type d); do
if [[ "$DIR" == "." ]]; then
@jrnewell
jrnewell / tango.reg
Last active August 29, 2015 14:08
Windows Console Colors
Windows Registry Editor Version 5.00
; Modified Tango Desktop Project color scheme for windows console
; See : http://en.wikipedia.org/wiki/Tango_Desktop_Project#Palette
; Values stored as 00-BB-GG-RR
[HKEY_CURRENT_USER\Console]
; BLACK DGRAY
"ColorTable00"=dword:00222222
"ColorTable08"=dword:00454545
; BLUE LBLUE
@jrnewell
jrnewell / fix-homebrew.md
Last active August 29, 2015 14:08
Fix npm with homebrew on Mac OS X

Fix npm with homebrew on Mac OS X

Adopted from this gist.

rm -rf /usr/local/lib/node_modules
brew uninstall node
brew install node --without-npm
echo prefix=${HOME}/local/npm >> ~/.npmrc  # only do once
mkdir ${HOME}/local/npm
@jrnewell
jrnewell / Pastel.xml
Last active August 29, 2015 14:08
IntelliJ Pastel Settings
<?xml version="1.0" encoding="UTF-8"?>
<scheme name="Pastel" version="124" parent_scheme="Default">
<option name="LINE_SPACING" value="1.0" />
<option name="EDITOR_FONT_SIZE" value="14" />
<option name="EDITOR_FONT_NAME" value="Consolas" />
<colors>
<option name="ADDED_LINES_COLOR" value="295622" />
<option name="CARET_COLOR" value="bbbbbb" />
<option name="CARET_ROW_COLOR" value="2f393c" />
<option name="CONSOLE_BACKGROUND_KEY" value="1f2223" />
@jrnewell
jrnewell / extract-jdk.sh
Created November 23, 2014 22:16
Extract JDK.exe into a portable folder (cygwin/windows)
#!/bin/bash
if [[ $# -ne 1 ]]; then
echo "usage: $0 <jdk.exe>"
echo "result will be in ./jdk"
exit 1
fi
JDK_EXE=$1
cabextract "$JDK_EXE" -d jdk_extract
#!/bin/bash
# +----------------------------------------------------------------------+
# | |
# | Set up Mac OS X to store temporary files in RAM rather than on disk.|
# | Updated for Yosemite, 16 GB of RAM |
# | |
# | By James Newell <jrnewell@github> |
# | |
# | Originally by Ricardo Gameiro <http://blogs.nullvision.com/?p=357> |
@jrnewell
jrnewell / track_names.py
Created July 2, 2015 15:44
Get Track and Artist names from a list of Spotify URIs
#!/usr/bin/env python
# coding=utf-8
import os
import sys
import requests
import time
def get_track_json(track_id):
url = 'https://api.spotify.com/v1/tracks/' + track_id