Skip to content

Instantly share code, notes, and snippets.

View refractalize's full-sized avatar

Tim Macfarlane refractalize

View GitHub Profile
@refractalize
refractalize / XmlKeyValues.cs
Created February 6, 2012 10:12
serializing key value pairs in a dictionary with System.Xml.Serialization.XmlSerializer
[TestFixture]
public class TrackXml {
[Test]
public void ShouldSerialiseKeyValuePairs() {
var xml = @"<track><title>Abracadabra</title><artist>Steve Miller Band</artist></track>";
var track = new Track();
track.Properties["title"] = "Abracadabra";
track.Properties["artist"] = "Steve Miller Band";
@refractalize
refractalize / decrypt.rb
Created January 4, 2012 20:11
Decrypt HTTP Live Streaming TS files
def read_m3u8(m3u8)
File.open(m3u8, 'r') do |file|
keyfile = nil
iv = 0
file.each_line do |line|
line.chomp!
if line =~ /^#EXT-X-KEY:METHOD=AES-128,URI="(.*?)"(,IV=0x(.*))?/
keyfile = $1
if $2
iv = $3

Keybase proof

I hereby claim:

  • I am refractalize on github.
  • I am refractalize (https://keybase.io/refractalize) on keybase.
  • I have a public key whose fingerprint is CFC3 8862 C872 801C 67D4 61C7 AC49 495C A39E 824D

To claim this, I am signing this object:

const child_process = require('child_process')
const {promisify} = require('util')
const exec = promisify(child_process.exec)
module.exports = class CommandLineSetup {
setup () {
}
teardown () {
}
@refractalize
refractalize / gist:cb6285c0b66466212e4e6ea203e84e9d
Last active March 2, 2018 13:54 — forked from dobiedad/gist:8c70d77d1f2412096a6e7a215779bd20
Changing a property React+Redux vs Hyperdom

Hyperdom

import hyperdom from 'hyperdom'
import h from hyperdom.html
import renderProductGrid from '../productGrid'
import ProductService from '../../services/product'

class Orders {
  constructor(){
@refractalize
refractalize / install_node-oracledb_on_elcapitan.md
Last active January 13, 2017 11:30 — forked from kubo/install_node-oracledb_on_elcapitan.md
Install node-oracledb on OS X 10.11 El Capitan

Installing Oracle Clients on Mac OS X El Capitan

(This page is a simplification of another guide to installing oracle on Mac OS X, from which this was forked.)

Get InstantClient version numbers

Run these brew commands:

brew install InstantClientTap/instantclient/instantclient-basiclite
@refractalize
refractalize / index.js
Created July 21, 2016 11:21
requirebin sketch
var plastiq = require('plastiq');
var h = plastiq.html;
var model = {value: "1"};
function render() {
return h('div',
model.value == "1"? h('h1', 'you have selected 1'): undefined,
h('label',
'One',
@refractalize
refractalize / docker-rhel-7.md
Last active April 18, 2016 15:27
Running Docker on RHEL 7

RPM repositories

subscription-manager repos --enable=rhel-7-server-extras-rpms
subscription-manager repos --enable=rhel-7-server-optional-rpms

Install

yum install docker

Startup options

@refractalize
refractalize / device.rb
Last active December 29, 2015 02:29
Timing and Retry for Selenium
require 'selenium-webdriver'
require 'ap'
class Scope
def find type, query
Element.new self, type, query
end
def where(name, &predicate)
Where.new self, name, predicate
@refractalize
refractalize / syncasync.pogo
Created October 10, 2013 08:48
How to make functions both synchronous and asynchronous at the same time. The caller decides.
function (f) is asynchronous =
r/function(.*continuation)/.test (f.to string ())
ensure (b) is asynchronous =
if (function (b) is asynchronous)
b
else
@(args, ..., cont)
try
cont (nil, b (args, ...))