Skip to content

Instantly share code, notes, and snippets.

View stojg's full-sized avatar

Stig Lindqvist stojg

View GitHub Profile
<?php
error_reporting(E_ALL);
/* Allow the script to hang around waiting for connections. */
set_time_limit(0);
/* Turn on implicit output flushing so we see what we're getting
* as it comes in. */
ob_implicit_flush();
#!/bin/sh
############################
# Author: Till Klampaeckel #
# License: New BSD License #
############################
version=$1
if [ "x$version" = "x" ]; then
echo "Usage: ./$0 5.0|5.1"
@stojg
stojg / Flowdock.php
Last active January 24, 2018 21:31
<?php
/**
* Send an message to a Flowdock "flow".
*
* # Initialization:
* <code>
* $fd = new Flowdock();
* $fd->setToken('asdadsads');
* </code>
*
@stojg
stojg / gist:5043372
Created February 26, 2013 23:30
chmod that sucker
find assets -type d -exec chmod 775 {} \;
find assets -type f -exec chmod 664 {} \;
@stojg
stojg / deploy.rb
Last active December 14, 2015 19:59
Capistrano testing
# Arbitrary variable, useful to store your application name within.
set :application, "project"
# The URL of the repository that hosts our code for example
# http://github.com/capistrano/capistrano.git
set :repository, "ssh://git@gitorious/project/repo.git"
# The path on the servers we’re going to be deploying the application to.
# The default is /u/apps/.
set :deploy_to, "/tmp/#{application}"
@stojg
stojg / bench.sh
Created March 14, 2013 00:32 — forked from chillu/bench.sh
#/bin/bash
# Compares response times on a specific URL on different SilverStripe versions.
#
# USAGE: bench.sh <base-path> <base-url>
basepath=$1
baseurl=$2
urls="/?flush=all /"
abparams="-n 10"
@stojg
stojg / gist:5210543
Created March 21, 2013 03:48
/etc/init.d/phpnaut
#!/bin/bash
#
# chkconfig: 345 80 20
# description: Running one resque worker
#
# start of configuration
RUN_USER=www-data
RUN_GROUP=$RUN_USER
APP_DIR=/path/to/framework/cli-script.php
@stojg
stojg / QuickLink.php
Last active December 15, 2015 09:49
This is an example of using the siteconfig decorator for adding a sitewide quicklinks navigation
@stojg
stojg / .bash_prompt
Last active December 15, 2015 16:29
My favorite bash prompt
PS1="\[\033[0;33m\][\!]\`if [[ \$? = "0" ]]; then echo "\\[\\033[32m\\]"; else echo "\\[\\033[31m\\]"; fi\`[\u@\h: \`if [[ `pwd|wc -c|tr -d " "` > 18 ]]; then echo "\\W"; else echo "\\w"; fi\`]\$\[\033[0m\] "; echo -ne "\033]0;`hostname -s`:`pwd`\007"
@stojg
stojg / pr.md
Created April 16, 2013 22:23 — forked from piscisaureus/pr.md

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: