Skip to content

Instantly share code, notes, and snippets.

View timini's full-sized avatar
🏗️
Building..

Tim Richardson timini

🏗️
Building..
View GitHub Profile
@timini
timini / Genomics_A_Programmers_Guide.md
Created May 17, 2019 11:22 — forked from andy-thomason/Genomics_A_Programmers_Guide.md
Genomics a programmers introduction

Genomics - A programmer's guide.

Andy Thomason is a Senior Programmer at Genomics PLC. He has been witing graphics systems, games and compilers since the '70s and specialises in code performance.

https://www.genomicsplc.com

import numpy as np
from pprint import pprint
class Graph:
def __init__(self, directed=False):
self._adj_matrix = np.zeros([0,0])
self._nodes = []
self._directed = directed
def debug(self):
const nodes = [];
const adjMatrix = {};
function breakPieces (shape){
shape = shape.split('\n');
let height = shape.length;
let width = shape[0].length;
// create a list with the co-ordinates of each '+'
@timini
timini / open_vm_ports.sh
Created February 19, 2016 16:57
open all ports on the boot2docker machine used by docker-machine
for i in {80..20000}; do
VBoxManage modifyvm "default" --natpf1 "tcp-port$i,tcp,,$i,,$i";
VBoxManage modifyvm "default" --natpf1 "udp-port$i,udp,,$i,,$i";
done
@timini
timini / gist:47b59ab3ef7ed0becbed
Last active September 2, 2015 17:07 — forked from ruckus/gist:2293434
Basic setup of WAL-E for continuous archiving and recovery

WAL-E needs to be installed on all machines, masters and slaves.

How to install WAL-E

Only one machine, the master, writes WAL segments via continuous archiving. The configuration for the master postgresql.conf is:

archive_mode = on
archive_command = 'envdir /etc/wal-e.d/env wal-e wal-push %p'
archive_timeout = 60
@timini
timini / 1.README.md
Last active August 29, 2015 14:24 — forked from varemenos/1.README.md

Get Git log in JSON format

git log --pretty=format:'{%n  "commit": "%H",%n  "abbreviated_commit": "%h",%n  "tree": "%T",%n  "abbreviated_tree": "%t",%n  "parent": "%P",%n  "abbreviated_parent": "%p",%n  "refs": "%D",%n  "encoding": "%e",%n  "subject": "%s",%n  "sanitized_subject_line": "%f",%n  "body": "%b",%n  "commit_notes": "%N",%n  "verification_flag": "%G?",%n  "signer": "%GS",%n  "signer_key": "%GK",%n  "author": {%n    "name": "%aN",%n    "email": "%aE",%n    "date": "%aD"%n  },%n  "commiter": {%n    "name": "%cN",%n    "email": "%cE",%n    "date": "%cD"%n  }%n},'

The only information that aren't fetched are:

  • %B: raw body (unwrapped subject and body)
  • %GG: raw verification message from GPG for a signed commit
@timini
timini / router.js
Last active August 29, 2015 14:24 — forked from knownasilya/router.js
var Router = Ember.Router.extend({
location: config.locationType,
init: function () {
this._super.apply(this, arguments);
// Listen for the first transition, and trigger the `setupMapOnFirstLoad` action when it's complete.
this.one('willTransition', function (transition) {
transition.then(function () {
// do something..
function gnn (cases, wide, tall, population, iterations, error_fn, error_thresh) {
var inputs = cases[0][0].length;
var outputs = cases[0][1].length;
// declare net, provide input layer
var net = [new Array(inputs)];
// create input neurons in input layer
for (var i = 0; i < inputs; i++)
net[0][i] = {output: 0}
// create hidden layers
for (var x = 0; x < wide; x++) {
@timini
timini / tree.md
Created March 11, 2014 10:20 — forked from hrldcpr/tree.md

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

float[][] verticies = {{ 0 , 0 , 12 },
{ 0.931306 , -2.86627 , 11.6154 },
{ 3.01377 , 0 , 11.6154 },
{ 1.94952 , -6 , 10.2078 },
{ 4.34164 , -3.15439 , 10.7331 },
{ 6.30877 , 0 , 10.2078 },
{ 2.79392 , -8.5988 , 7.89016 },
{ 5.36656 , -6.30877 , 8.68328 },
{ 7.65836 , -3.15439 , 8.68328 },
{ 9.04131 , 0 , 7.89016 },