Skip to content

Instantly share code, notes, and snippets.

View GeorgeDewar's full-sized avatar

George Dewar GeorgeDewar

  • Wellington, New Zealand
View GitHub Profile

Keybase proof

I hereby claim:

  • I am georgedewar on github.
  • I am georgedewar (https://keybase.io/georgedewar) on keybase.
  • I have a public key ASD35yet3brxEy0eiJvjJ5-DQgGxxdHbIW5dKRJxNKhTwwo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am GeorgeDewar on github.
  • I am georgedewar (https://keybase.io/georgedewar) on keybase.
  • I have a public key whose fingerprint is C785 F10D 113C 91D8 7BEB 7759 1AE0 8CE9 255B 3067

To claim this, I am signing this object:

@GeorgeDewar
GeorgeDewar / example.js
Created March 5, 2016 08:23
A technique for keeping the UI thread moving when you need to do a fair bit of processing
var loadChain = new LoadChain();
loadChain.push(function(){
console.log("Intensive work is happening here...");
});
loadChain.push(function(){
console.log("And some more is happening here...");
});
@GeorgeDewar
GeorgeDewar / gist:22ea744475a19b9871ff
Last active August 29, 2015 14:11
LINZ Landonline Schema
drop table action_type cascade;
create table action_type (
type varchar(4),
description varchar(200) not null,
system_action char(1) not null,
sob_name varchar(50), -- FK
existing_inst char(1) not null,
audit_id integer not null
);
@GeorgeDewar
GeorgeDewar / es-centos
Last active August 29, 2015 14:00
Install ElasticSearch on CentOS 6.4
#!/bin/bash
yum install -y java-1.7.0-openjdk
cat > /etc/yum.repos.d/ElasticSearch-1.0.repo <<- EOF
[elasticsearch-1.0]
name=Elasticsearch repository for 1.0.x packages
baseurl=http://packages.elasticsearch.org/elasticsearch/1.0/centos
gpgcheck=1
gpgkey=http://packages.elasticsearch.org/GPG-KEY-elasticsearch
@GeorgeDewar
GeorgeDewar / ng
Last active August 29, 2015 14:00
Enable and disable nginx sites
#!/bin/bash
function usage {
echo "Manage nginx sites"
echo
echo "Usage:"
echo
echo "ng pull"
echo "ng push"
echo "ng list"
/*
* IRrecord: record and play back IR signals as a minimal
* An IR detector/demodulator must be connected to the input RECV_PIN.
* An IR LED must be connected to the output PWM pin 3.
* A button must be connected to the input BUTTON_PIN; this is the
* send button.
* A visible LED can be connected to STATUS_PIN to provide status.
*
* The logic is:
* If the button is pressed, send the IR code.
#!/bin/bash
function usage {
echo Enable or disable CNTLM proxy settings in the current terminal
echo
echo Usage:
echo
echo "source proxy <on / off>"
}
@GeorgeDewar
GeorgeDewar / gist:11171561
Created April 22, 2014 09:21
Checksum calculation example for IR codes of a Fujitsu heat pump (remote AR-RAH1E)
# Sample data
data = []
data[0] = '00101000110001100000000000001000 00001000011111111001000000001100 00001101100000001000000000000000 00000000000000000000010001111111'
data[1] = '00101000110001100000000000001000 00001000011111111001000000001100 00000011100000001000000000000000 00000000000000000000010001110111'
data[2] = '00101000110001100000000000001000 00001000011111111001000000001100 00001101100011001000000000000000 00001011111110010000010011111010'
data[3] = '00101000110001100000000000001000 00001000011111111001000000001100 00001101100000001000100000000000 00000000000000000000010001110111'
data[4] = '00101000110001100000000000001000 00001000011111111001000000001100 00001101000000000000100000000000 00000000000000000000010000001111'
# Checksum function
#!/usr/bin/ruby
require 'json'
require 'term/ansicolor'
require 'optparse'
require 'httparty'
require 'set'
include Term::ANSIColor