Skip to content

Instantly share code, notes, and snippets.

View stigkj's full-sized avatar

Stig Kleppe-Jørgensen stigkj

View GitHub Profile
@stigkj
stigkj / Vagrantfile
Created July 23, 2014 08:16
Vagrantfile for installing nsinit in VM
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "boot2docker-nsinit"
config.vm.box = "yungsang/boot2docker"
@stigkj
stigkj / README.md
Last active August 29, 2015 14:08 — forked from jpetazzo/README.md

Rectifier

The diode bridge is the simplest rectifier I know.

Rectifier lets you share a directory with a docker container (just like $yourvm shared folders).

You don't have to install anything in your containers, and you only need to install diod in the host. diod is packaged on Ubuntu/Debian distros, and will automatically be apt-get install-ed if needed.

Since it uses diod to make a bridge, I called it rectifier. Yeah, that sucks, so if you have a better name, I'll steal it!

#!/bin/sh
#
# Creates a SmartOS VM in VirtualBox (assuming you alread have VirtualBox installed)
#
# This script will:
# * Download the latest live ISO image of SmartOS
# * Create a VirtualBox VM, or update an existing VM with the latest ISO
# * Configure the VM with a zones disk, and boot it!
#
#
@stigkj
stigkj / mergefrom.rb
Created March 3, 2010 15:34 — forked from andre/mergefrom.rb
A dirt-simple script to merge a pull request from someone on github
#! /usr/bin/env ruby
require "open3" # for reading stderr
# A dirt-simple script to merge a pull request from someone on github.
# Andre Lewis, 2009
#
# Assumptions:
# 1. you're currently working on master
# 2. you've already reviewed the pull request and have decided to include it.
@stigkj
stigkj / gist:365923
Created April 14, 2010 15:24 — forked from matthewmccullough/gist:47267
Another git dirty status in prompt
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_NONE="\[\e[0m\]"
public static void setSwingFontDefault(javax.swing.plaf.FontUIResource newFont) {
java.util.Enumeration<Object> uiManagerKeys = UIManager.getDefaults().keys();
while (uiManagerKeys.hasMoreElements()) {
Object key = uiManagerKeys.nextElement();
Object value = UIManager.get(key);
if (value instanceof javax.swing.plaf.FontUIResource)
UIManager.put(key, newFont);
}
}
@stigkj
stigkj / Look for JARs containing...
Created April 14, 2010 15:23 — forked from matthewmccullough/findjars.bsh
Find class in all jars recursively
#!/bin/sh
#Example Usage: findjars com/ambientideas/groovy
CLASSNAMETOFIND="$1"
echo "Searching all JARs recursively..."
for eachjar in `find . -iname "*.jar"`
do
#echo "Searching in $eachjar ..."
@stigkj
stigkj / gist:365929
Created April 14, 2010 15:27 — forked from augustjoki/gist:31867
Improved parse git branch version for the git prompt
function parse_git_branch {
[ -d .git ] || return 1
git_status="$(git status 2> /dev/null)"
branch_pattern="^# On branch ([^${IFS}]*)"
remote_pattern="# Your branch is (.*) of"
diverge_pattern="# Your branch and (.*) have diverged"
if [[ ! ${git_status}} =~ "working directory clean" ]]; then
state="*"
fi
# add an else if or two here if you want to get more specific
@stigkj
stigkj / .bashrc
Created April 14, 2010 15:22 — forked from matthewmccullough/.bashrc
Show git branch/'dirtyness' in prompt
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'dependency'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - com.mycompany.app:my-app:jar:1
[INFO] task-segment: [dependency:tree]
[INFO] ------------------------------------------------------------------------
Downloading: http://download.java.net/maven/2/org/springframework/spring-context/3.0.3.RELEASE/spring-context-3.0.3.RELEASE.pom
[INFO] Unable to find resource 'org.springframework:spring-context:pom:3.0.3.RELEASE' in repository java-net (http://download.java.net/maven/2)
Downloading: http://repo1.maven.org/maven2/org/springframework/spring-context/3.0.3.RELEASE/spring-context-3.0.3.RELEASE.pom