Skip to content

Instantly share code, notes, and snippets.

View putermancer's full-sized avatar

Ben Loveridge putermancer

View GitHub Profile
@putermancer
putermancer / gist:591964
Created September 22, 2010 16:01
Set up a local solr instance on mac
# Setting up a local solr instance on a mac
# install solr with homebrew
brew install solr
# create the base solr index directory
mkdir -p /data/solr
# make sure you can write to the solr logs
sudo chown -R `whoami` /usr/local/Cellar/solr/
@putermancer
putermancer / bzr2git.py
Created October 13, 2010 21:18
Migrate a bzr repo (with history) to git
#!/usr/bin/env python
import os, shutil, subprocess, time
from optparse import OptionParser
USAGE = """%prog [options] name
Converts a bzr repository into a git repository and preps it for git-flow"""
def run(*cmds):
output = []
@putermancer
putermancer / gitinit.sh
Created November 2, 2010 16:36
Quickly set up a shared git repository
REPONAME=${1%/} # trim trailing slash
if [ ! -d "$REPONAME" ]; then
# Make a temporary working directory
mkdir $REPONAME && cd $REPONAME
echo .DS_Store > .gitignore # ignore a common MacOS file
# make an initial commit
git init && git add .gitignore && git commit -m "initial commit"
else
@putermancer
putermancer / .gitconfig
Last active June 15, 2022 08:37
git aliases
[alias]
man = help
unadd = reset HEAD
#co = checkout
co = "!f(){ git checkout \"$@\" && git sup; }; f"
feature = "!git reset HEAD && git checkout -b feature/\"$1\" && git commit --allow-empty -m \"Created feature branch $1\" && git push --set-upstream origin feature/\"$1\" && echo Branch feature/$1 published to origin"
cp = cherry-pick
sma = submodule add
st = status
br = branch
@putermancer
putermancer / gist:847755
Created February 28, 2011 18:24
git + gitolite shell access, user-based
#!/bin/bash
shift # get rid of -c
# if no commands, just open a shell
if [[ $# -eq 0 ]]; then
/bin/bash -l
# if the first arg is a git- command, that means it is something like git-push, etc... so forward it
elif [[ $1 == git-* ]]; then
ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no git@localhost $*
@putermancer
putermancer / devscreen.sh
Created September 22, 2010 16:04
development screen session shortcut
#!/bin/bash
# Simple way to create a main development screen in the
# right base directory, or re-attach to the one that is
# already setup.
# I create a symlink or alias 's' so I am always one keystroke
# away from my dev screen.
if screen -ls | grep main > /dev/null
@putermancer
putermancer / gist:4261328
Created December 11, 2012 19:30
Proboards: jump to best post (first unread or most recent) in a thread
<script type="text/javascript">
<!--
// Jump to the best post (first first unread or most recent) in a thread.
// Originally by Todge, but completely rewritten by Ben Loveridge.
if(document.location.href.match('board=')&&!document.location.href.match('action=')) {
var table_cells = document.getElementsByTagName('td'),
create_cell_click_fn = function(href) {
return function() { if (!window.pb_bubble) { window.location.href = href; } };
},
cell, is_topic_cell, has_new_post, new_post_href, best_post_href, last_post_cell, last_post_groups, last_post_href;
@putermancer
putermancer / blove-git-flow.rb
Created December 20, 2011 22:17
homebrew Formula to install blove's fork of gitflow
require 'formula'
class GitFlowCompletion < Formula
homepage 'https://github.com/bobthecow/git-flow-completion'
url 'https://github.com/bobthecow/git-flow-completion/tarball/0.4.1.0'
md5 '95c05d1a278c1c41067bd7cc6c281ecd'
head 'https://github.com/bobthecow/git-flow-completion.git', :branch => 'develop'
end
@putermancer
putermancer / gist:1395160
Created November 26, 2011 06:18
jsonp (maybe not entirely cross-browser friendly)
/**
* Function: getRandomId
* Generates a unique-ish hex string between 1 and 32 characters long.
*/
rrandomidreplace : /x/g,
getRandomId : function(length) {
length = length && length > 0 && length <= 32 ? length : 32;
function getHexChar() {
var r = Math.random()*16|0;
return r.toString(16);
@putermancer
putermancer / .profile
Created June 23, 2011 17:24
bash info in prompt
# prompt including cwd, username, hostname, git branch #
export PS1="\[\e[0;32m\]\u\[\e[m\]\[\e[1;33m\]@\[\e[m\]\[\e[1;32m\]\h\[\e[m\]\[\e[0;33m\]:\[\e[m\]\[\e[1;37m\]\w\[\e[m\] \[\e[0;33m\]\$(git branch 2> /dev/null | grep -e '\* ' | sed 's/^..\(.*\)/{\1} /')\[\e[0;35m\]$ \[\e[m\]"
export SUDO_PS1="\[\e[0;32m\]\u\[\e[m\]\[\e[1;33m\]@\[\e[m\]\[\e[1;32m\]\h\[\e[m\]\[\e[0;33m\]:\[\e[m\]\[\e[1;37m\]\w\[\e[m\] \[\e[0;33m\]\$(git branch 2> /dev/null | grep -e '\* ' | sed 's/^..\(.*\)/{\1} /')\[\e[0;35m\]$ \[\e[m\]"
# terminal colors #
export CLICOLOR='true'