Skip to content

Instantly share code, notes, and snippets.

View mfairchild365's full-sized avatar

Michael Fairchild mfairchild365

View GitHub Profile
@Ribesg
Ribesg / bash_aliases.sh
Last active December 31, 2015 12:09
Here's my server's Starbound related config files and scripts.
alias sb_start="sudo start starbound"
alias sb_stop="sudo stop starbound"
alias sb_restart="sb_stop;sb_start"
alias sb_update="sudo /home/ribesg/sb_update"
alias sb_online="netstat -nt | grep -c 21025"
alias sb_status="sudo status starbound"
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@saltybeagle
saltybeagle / gitmigrat.sh
Created May 2, 2012 15:26
svn2git all GForge repositories
migratdir=$PWD
for dir in `ls -1 */.svn/entries | xargs grep -H -l gforge | grep -E -o "^[^\/]+"`; do
echo $dir
mkdir /Users/bbieber/workspace/gitmigrat/$dir
cd /Users/bbieber/workspace/gitmigrat/$dir
svn2git `svn info $migratdir/$dir | grep ^Repository\ Root | cut -f 3 -d ' '` --authors $migratdir/gforgemigration/authors.txt --verbose
done
@saltybeagle
saltybeagle / gist:1260758
Created October 4, 2011 02:14
Self-contained PHPUnit with Pyrus
mkdir phpunit
cd phpunit
pyrus `pwd` set bin_dir `pwd`/bin
pyrus `pwd` install http://components.ez.no/get/ConsoleTools-1.6.1.tgz http://components.ez.no/get/Base-1.8.tgz pear.phpunit.de/PHPUnit
To set the include_path, replace the first line of bin/phpunit with:
#!/usr/bin/php -d include_path=/path/to/phpunit/php
@saltybeagle
saltybeagle / Router.php
Created July 13, 2011 20:33
Simple router idea, uses array of routes
<?php
class Router
{
protected static $routes = array();
public static function route($requestURI, $options = array())
{
if (!empty($_SERVER['QUERY_STRING'])) {
$requestURI = substr($requestURI, 0, -strlen(urldecode($_SERVER['QUERY_STRING'])) - 1);