Skip to content

Instantly share code, notes, and snippets.

View JorgenEvens's full-sized avatar

Jorgen Evens JorgenEvens

View GitHub Profile
@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 / 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 / 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"
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="agnoster"
# Example aliases
@JorgenEvens
JorgenEvens / fix-indentation.sh
Created July 21, 2015 16:17
Script that converts indentation format
#!/bin/sh
set -e
# Convert indentation from $INDENT_CURRENT to $INDENT_TARGET
INDENT_CURRENT=" " # 1 Tab
INDENT_TARGET=" " # 4 Spaces
EXTENSION="*.php"
is_dirty() {
@JorgenEvens
JorgenEvens / BaseAware.js
Created August 19, 2015 07:42
A React composite component that loads properties for us and prevents re-rendering until it changes.
import _ from 'lodash';
import React from 'react';
const debug = false;
const log = debug ? console.log.bind(console) : () => {};
const getPath = ( obj, path, defaultValue ) => {
_.each( path.split('.'), function( key ) {
if( _.isUndefined( obj ) )
return false;
@JorgenEvens
JorgenEvens / nodeapp.js
Created November 4, 2015 21:13
Shared hosting nodejs application without providing shell access.
var path = require('path');
var chroot = require('chroot');
var CHROOT_DIR = '/www';
var CHROOT_WWW = '/vhost/domain/http/';
var CHROOT_NODE_BIN = '/vhost/bin/node';
var USER = 2000;
var GROUP = 2000;
var webDir = path.join(__dirname, '..', 'http');
@JorgenEvens
JorgenEvens / IR_Sensor.ino
Last active November 21, 2015 22:55
Code to read IR codes from a remote using 1838B sensor
#include <Arduino.h>
// Enable debug printing of signal
// #define DEBUG_SIGNAL
// Enable debug for HEX codes
// #define DEBUG_CODES
// Only store time that signal was up.
// #define STORE_DOWN
@JorgenEvens
JorgenEvens / build-sass-jar.sh
Last active December 19, 2015 17:08
Create a jar which allows the usage of sass and compass through jruby (JVM). This allows you to use sass without having to install Ruby on your system.
#!/bin/sh
# Download a copy of the jruby-complete jar [here](http://www.jruby.org/download),
# and pass it as the first parameter to the script.
JRUBY="$1"
JAVA="java"
# Install compass / sass gems.
$JAVA -jar "$JRUBY" -S gem install compass -i ./tmp/gems
$JAVA -jar "$JRUBY" -S gem install --version '~> 0.9' rb-inotify -i ./tmp/gems
@JorgenEvens
JorgenEvens / .bash_aliasses
Created July 25, 2013 19:16
bash aliasses
alias gitrm='git ls-files -d | xargs git rm'