Skip to content

Instantly share code, notes, and snippets.

@nbrew
nbrew / .git-prompt.sh
Last active August 26, 2019 15:24
My latest bash prompt customization. Colored Git bash prompt.
#!/bin/bash
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# If you don't already have git-completion installed:
#
# cd ~/
# curl -OL https://github.com/git/git/raw/master/contrib/completion/git-completion.bash
# mv ~/git.completion.bash ~/.git-completion.bash
@nbrew
nbrew / Mavericks Update Notes.md
Created February 28, 2014 23:02
Reload all installed homebrew formulas. (I found this useful after updating from OS X 10.8.x to 10.9.)
  • Download the Command Line Tools (OS X Mavericks) from https://developer.apple.com/downloads

  • From the Terminal:

    sudo xcode-select --reset sudo xcode-select --switch /Library/Develop/CommandLineTools

  • Install openssl with homebrew:

    brew remove openssl brew install openssl

# source: https://trac.ffmpeg.org/wiki/CentosCompilationGuide
yum install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel
mkdir ~/ffmpeg_sources
cd ~/ffmpeg_sources
curl -O http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar xzvf yasm-1.2.0.tar.gz
cd yasm-1.2.0
@nbrew
nbrew / delayed_job_init.sh
Last active March 13, 2018 18:55 — forked from stuzart/gist:3169625
Simple init script for starting group of delayed_job workers.
#!/bin/sh
# upstart-job
#
# Symlink target for initscripts that have been converted to Upstart.
set -e
APP_PATH="/srv/rails/seek"
APP_NAME="Seek"
APP_USER="www-data"
NUM_WORKERS="1"
@nbrew
nbrew / touchEvents.js
Created April 10, 2014 18:42
Deal with touch events on a list. (Touch duration, swipe.)
var timeout,
longtouch,
xDown,
yDown;
$("#myList li").bind('touchstart', function() {
timeout = setTimeout(function() {
longtouch = true;
}, 300);
}).bind('touchend', function() {
@nbrew
nbrew / headbobber.cs
Created May 8, 2014 21:45
Unity Headbobber.js to C#
using UnityEngine;
using System.Collections;
public class Headbobber : MonoBehaviour {
private float timer = 0.0f;
public float bobbingSpeed = 0.18f;
public float bobbingAmount = 0.2f;
public float midpoint = 2.0f;
@nbrew
nbrew / toggle_power_profiles.bat
Created May 23, 2014 00:49
Batch file to toggle between two POWERCFG schemes.
@ECHO OFF
'
' SETUP:
' To get the GUIDs required, in Windows Powershell, run:
'
' POWERCFG -L
'
' Then select and right-click a GUID to copy.
'
@nbrew
nbrew / switch_network.sh
Created July 9, 2014 01:50
Hackish sed scripts to change network interfaces from DHCP to Static IP on a CubieTruck
#!/bin/bash
# SETUP:
# * Replace '#iface eth0 inet<some-char>dhcp' with '# iface eth0 inet dhcp'
net="${1}"
function usage() {
echo "USAGE: ${0} (dhcp|static)"
echo
@nbrew
nbrew / chef_knife_dl.sh
Created August 28, 2014 00:04
Chef knife download and untar cookbook function
function knife_dl() {
local packages="$@"
cd /root/chef-repo/cookbooks
for c in ${packages}; do
knife cookbook site download ${c};
tar zxf ${c}*.tar.gz;
rm ${c}-*.tar.gz;
done
}
@nbrew
nbrew / FadeTest.cs
Created August 28, 2014 20:25
Unity 3D FadeTest - Fade object alpha over time.
using UnityEngine;
using System.Collections;
public class FadeTest : MonoBehaviour
{
Color startColor;
Color currentColor;
Color endColor;
bool shouldFade = false;
float startTime;