Skip to content

Instantly share code, notes, and snippets.

View corny's full-sized avatar

Julian Kornberger corny

View GitHub Profile
# A wrapper for IO.popen that returns the combined stdout and stderr.
# An exception is thrown if the subprocess exists with non-zero.
# by Julian Kornberger
module Subprocess
class Error < ::StandardError
attr_reader :status, :output
def initialize(args, status, output)
super "Subprocess #{args.inspect} exited with status #{status}:\n#{output}"
@status = status
@corny
corny / apache2-mod_spdy.sh
Created July 28, 2014 12:05
Install mod_spdy for apache2
#!/bin/sh -e
sudo apt-get -y install git-core g++ apache2 libapr1-dev libaprutil1-dev patch binutils make devscripts
git clone https://github.com/eousphoros/mod-spdy.git
cd mod-spdy/src
./build_modssl_with_npn.sh
chmod +x ./build/gyp_chromium
make BUILDTYPE=Release
cp ./out/Release/libmod_spdy.so /usr/lib/
cp mod_ssl.so /usr/lib/apache2/modules/
@corny
corny / newkey.php
Last active August 29, 2015 14:04 — forked from jplitza/newkey.php
<?php
require("write_key.inc.php");
$result = write_key($_GET['name'], $_GET['key'], $_GET['mac']);
if(!$result)
header("Status: 422 Unprocessable Entity");
?>
<!DOCTYPE html>
@corny
corny / update_ip.php
Created August 14, 2014 07:05
Update no-ip.com und tunnelbroker simultaneously (dyndns)
<?php
# Update no-ip.com und tunnelbroker simultaneously (dyndns)
error_reporting(E_ALL);
$key = "secret-key";
$addr = isset($_GET['addr']) ? $_GET['addr'] : $_SERVER['REMOTE_ADDR'];
if($_GET['key'] != $key){
header("Status: 401 Unauthorized");
@corny
corny / sidekiq.rake
Last active August 29, 2015 14:06
Capistrano tasks for stopping Sidekiq
# lib/capistrano/tasks/sidekiq.rake
namespace :load do
task :defaults do
set :sidekiq_role, ->{ :app }
end
end
namespace :sidekiq do
def for_each_process(command)
@corny
corny / update-hostkeys.sh
Last active August 29, 2015 14:07
Update script for known_hosts
#!/bin/sh -e
if [ "$#" = "0" ]; then
echo "missing hosts"
exit 1
fi
for host in $@; do
inet=`dig +short a $host`
inet6=`dig +short aaaa $host`
@corny
corny / network
Last active August 29, 2015 14:07
OpenWRT Bridged Repeater (tested on TL-WR841ND v9 with barrier breaker)
#/etc/config/network
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fdaa:ec6b:a862::/48'
@corny
corny / pluscard.rb
Last active August 29, 2015 14:20
Holt Kreditkartenumsätze von Pluscard ab
require 'mechanize'
class Pluscard
START = 'https://www.pluscard.de/kris/anmeldung/anmeldung.php'
Entry = Struct.new(:number,:buchungsdatum,:belegdatum,:betrag,:text)
def initialize(username,password)
@username = username
@corny
corny / fix-cpe.sh
Created July 18, 2015 17:48
Fix CPE network for Breminale
uci del network.port2
uci del network.port3
uci del network.port4
uci del network.port5
uci del network.port2_vlan
uci del network.port3_vlan
uci del network.port4_vlan
uci del network.port5_vlan
uci del network.office_vlan
uci set network.wan.ifname=eth0.2
@corny
corny / pc-sysinstall.cfg
Created July 29, 2015 15:10
PC Sysinstall Configuration
# Sample configuration file for an installation using pc-sysinstall
installMode=fresh
installInteractive=no
# Set if we are installing via optical, USB, or FTP
installType=FreeBSD
installMedium=usb
# List our components to install
installComponents=ports