Skip to content

Instantly share code, notes, and snippets.

View JorgenEvens's full-sized avatar

Jorgen Evens JorgenEvens

View GitHub Profile
@JorgenEvens
JorgenEvens / build-php.sh
Last active August 29, 2015 14:07
Build script for PHP5 heroku packages
#!/bin/sh
set -e
# Generates php-fpm and php-cli packages and php extension packages
# for use with the heroku modular buildpack
# https://github.com/JorgenEvens/heroku-modular-buildpack
### Configuration ###
PHP_VERSION="5.5.18"
@JorgenEvens
JorgenEvens / Gruntfile.js
Last active August 29, 2015 14:06
Boilerplate Gruntfile
module.exports = function(grunt) {
var pkg = grunt.file.readJSON('package.json');
grunt.initConfig({
pkg: pkg,
/* Deployment */
'ftp-deploy': {
build: {
@JorgenEvens
JorgenEvens / tunnel.sh
Last active August 29, 2015 14:04
Use OpenWRT to tunnel traffic to remote site
#!/bin/sh
REMOTE="tunnel-host -p 9099"
REMOTE_NET="192.168.1.0/24"
TUN=5
IF="tun$TUN"
SSH_OPT="-c arcfour256 -o Protocol=2 -o ServerAliveCountMax=2 -o ServerAliveInterval=5 -o ConnectTimeout=5"
echo $SSH_OPT
sleep 15 # Wait for device bootup
@JorgenEvens
JorgenEvens / copydb
Created December 30, 2013 13:59
Copy tables from a shared schema to your local schema in db2
#!/bin/sh
ME=`whoami`
SRC="project"
if [ -z "$1" ]; then
TABLES="table1 table2"
else
TABLES=$@
fi
copy() {
@JorgenEvens
JorgenEvens / db2-long
Created December 30, 2013 13:58
Run a query on a table without hitting the transaction log size
#!/bin/sh
TABLE="$1"
shift
db2 connect to dbarch
db2 +c "alter table $TABLE activate not logged initially"
db2 +c "$@"
db2 commit
@JorgenEvens
JorgenEvens / Angular HTML.tmLanguage
Last active December 26, 2015 00:49
Variable highlighting in AngularJS templates for Sublime Text
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>ang.tpl</string>
<string>ang.html</string>
<string>html</string>
<string>htm</string>
@JorgenEvens
JorgenEvens / make-sitemap.sh
Created August 29, 2013 21:22
Generates a sitemap by crawling all of the available links. example usages: ./make-sitemap http://my-site.com ./make-sitemap http://my-site.com daily
#!/bin/sh
##################################################
# #
# This script generates a sitemap from an #
# existing website by crawling each page #
# accessible to the outside world. #
# #
# Author: Jorgen Evens <jorgen@evens.eu> #
# License: New BSD License #
@JorgenEvens
JorgenEvens / xenvnc.sh
Created August 12, 2013 20:20
Connects to a VNC console on a xen host
#!/bin/sh
HOST=$1
PORT=$2
RUN=true
SOCK=`mktemp -t xenvnc.$HOST.$PORT.XXX`
rm $SOCK
ssh $HOST -f -q -S $SOCK -L $PORT:localhost:$PORT sleep 1d
@JorgenEvens
JorgenEvens / deploy-test.sh
Last active December 20, 2015 21:58
Test the build using a custom heroku buildpack on your own machine.
#!/bin/sh
if [ -z $1 ]; then
echo "Usage: $0 project-location"
exit 1
fi
if [ ! -d $1 ]; then
echo "Could not find your project"
exit 2
@JorgenEvens
JorgenEvens / inject-env.c
Created August 1, 2013 07:39
Sets custom environment variables before the shell starts. Was usefull as a workaround to get TERM=xterm-color inject when using terminator on ubuntu.
#include <unistd.h>
#include <stdlib.h>
int main(int argc, char **argv) {
char* shell = getenv("SHELL");
if( shell == NULL )
shell = "bash";
char* param[2];