Skip to content

Instantly share code, notes, and snippets.

View johnknott's full-sized avatar
🎯
Focusing

John Knott johnknott

🎯
Focusing
View GitHub Profile
@mattconnolly
mattconnolly / openvpn.xml
Created April 25, 2012 00:35
OpenIndiana SMF manifest for running openvpn as a service
<?xml version="1.0" ?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type="manifest" name="export">
<service name="network/openvpn" type="service" version="0">
<create_default_instance enabled="true"/>
<single_instance/>
<dependency name="fs" grouping="require_all" restart_on="none" type="service">
<service_fmri value="svc:/system/filesystem/local"/>
</dependency>
<dependency name="net" grouping="require_all" restart_on="none" type="service">
@peter
peter / creating-edgerails-app.sh
Created June 30, 2012 21:03
Creating and Deploying an EdgeRails (Rails 4) Application to Heroku
# 0. Make sure you have Ruby 1.9.3 installed, and optionally RVM and PostgreSQL
# 0.2 If you are on the Mac, make sure you have a c compiler by installing XCode Command Line Tools or gcc4.2 with homebrew
# https://github.com/mxcl/homebrew/wiki/Custom-GCC-and-cross-compilers
# 0.5 Make sure you have bundler version ~> 1.2 as Rails depends on it
gem install bundler
# 1. Get edge Rails source (master branch)
git clone https://github.com/rails/rails.git
@xdite
xdite / 42-things.md
Created July 14, 2012 05:11
Ten (42) Things You Didn't Know Rails Could Do
@jpawlowski
jpawlowski / msys_hetzner-etc_network_interfaces
Created August 12, 2012 12:06
Debian network configuration for Proxmox VE server running on a Hetzner host
# /etc/network/interfaces
#
auto lo
iface lo inet loopback
# device: eth0
iface eth0 inet manual
# IPv4 bridge
# (connect ONLY your firewall/router KVM instance here, this is the WAN device!)
@jahewson
jahewson / smartos-on-a-budget.sh
Last active March 9, 2024 07:27
Installing and Configuring SmartOS on a budget server (with a /29)
# Licensed under CC BY 3.0 http://creativecommons.org/licenses/by/3.0/
# Derived works must attribute https://gist.github.com/4492300 at the beginning, and the date.
##################################################################
Installing and Configuring SmartOS on a budget server (with a /29)
##################################################################
# if you find this gist useful, please star it
# please be aware that budget hosting companies usually cut corners somewhere,
@mszczepanczyk
mszczepanczyk / grab.c
Created May 27, 2013 09:30
ugly hack
// gcc grab.c -o grab -lX11
// ugly hack to catch windows key before application and change i3 workspace if windows+[0-9] is pressed
// usage: grab winid_1 winid_2 ...
// example:
// grab `xwininfo -root -tree -int |grep " - Oracle VM VirtualBox" | awk '{print $1}'`
#include <X11/X.h>
#include <X11/Xlib.h>
class Player
def initialize
@max_health = 20
@last_health = @max_health
@taking_damage = false
@directions = [:backward, :forward]
@current_direction = :forward
@reached_wall = false
end
@scy
scy / opening-and-closing-an-ssh-tunnel-in-a-shell-script-the-smart-way.md
Last active May 8, 2024 05:28
Opening and closing an SSH tunnel in a shell script the smart way

Opening and closing an SSH tunnel in a shell script the smart way

I recently had the following problem:

  • From an unattended shell script (called by Jenkins), run a command-line tool that accesses the MySQL database on another host.
  • That tool doesn't know that the database is on another host, plus the MySQL port on that host is firewalled and not accessible from other machines.

We didn't want to open the MySQL port to the network, but it's possible to SSH from the Jenkins machine to the MySQL machine. So, basically you would do something like

ssh -L 3306:localhost:3306 remotehost

@AlainODea
AlainODea / man2html-recursive.sh
Last active December 25, 2015 05:49
Use man2html to generate entire hyperlinked documentation from man pages
#!/bin/bash -e
#sudo apt-get -y install realpath man2html-base
#gem install ronn
#git clone git@github.com:joyent/illumos-joyent.git
#git clone git@github.com:joyent/smartos-live.git
pushd illumos-joyent
git pull
popd
pushd smartos-live
git pull
@mattmccray
mattmccray / router.js
Last active December 26, 2015 14:29
Simple Backbone/Exoskeleton Router for use with React (http://facebook.github.io/react/)
var _missing= function(data){ return React.DOM.pre(null, "Route not found: "+ data.route) },
_router= null,
_started= false,
_nextId= 1;
function handleRouteChange(container, component) {
var routeParams= Array.prototype.slice.call( arguments, 1 )
React.renderComponent(
component({ routeParams:routeParams }, null),
container