Skip to content

Instantly share code, notes, and snippets.

View johngeorgewright's full-sized avatar

John Wright johngeorgewright

View GitHub Profile
@johngeorgewright
johngeorgewright / AutoLaunch.profile.py
Last active June 3, 2020 09:46
An iTerm2 script which changes profiles dependent on variables
import asyncio
import iterm2
"""
This is where you put your configuration.
Edit this hash once you've set up your iTerm2 Profiles and created any
[user-defined](https://iterm2.com/documentation-scripting-fundamentals.html#setting-user-defined-variables)
[variables](https://iterm2.com/documentation-variables.html).
@johngeorgewright
johngeorgewright / app.js
Last active November 2, 2015 22:52
Register a WAMP procedure on more than one service. The idea being that a backup version of the service will register automatically if the primary one goes down.
import autobahn from 'autobahn';
const RPC_ADD2 = 'com.myapp.add2';
let connection = new autobahn.Connection({
url: 'ws://127.0.0.1:9000/ws',
realm: 'realm1',
use_es6_promises: true
});
import {Connection} from 'autobahn';
var connection = new Connection({
url: 'ws://127.0.0.1:8080/ws',
realm: 'realm1',
use_es6_promises: true
});
connection.onopen = (session) => {
session.subscribe('com.myapp.page', (args) => {
@johngeorgewright
johngeorgewright / .bashrc
Created April 14, 2014 15:57
Orient DB executions - assuming you've installed it in $HOME/Library/OrienTechnologies/OrientDB-1.7
function orient
{
if [ "$1" == 'db' ]
then
command="orientdb"
else
command="$1"
fi
sh $HOME/Library/OrienTechnologies/OrientDB-1.7/bin/$command.sh ${*:2}
}
@johngeorgewright
johngeorgewright / template.rb
Last active August 29, 2015 13:57
Codejam template. First argument passed to the script is considered an input file
file = File.new ARGV.shift, "r"
test_size = file.gets.to_i
(1..test_size).each do |item_num|
$stdout << "Case ##{item_num}: "
end