Skip to content

Instantly share code, notes, and snippets.

View bgourlie's full-sized avatar

W. Brian Gourlie bgourlie

View GitHub Profile
1. What
2. Is
3. This
4. Sorcery
@bgourlie
bgourlie / mortality.md
Last active December 2, 2017 21:54
Interpreting DUSCMPUB-formatted mortality data

Interpreting mortality data in DUSCMPUB format

This gist explains how to interpret the DUSCMPUB-formatted mortality data found [here][1] in conjunction with the [reference PDF][2].

The [reference PDF][2] uses 3 components to describe the type of data, its location within the row, and its size:

  • data item: A specific datapoint, for example, a value representing the highest completed level of education.
  • tape location: The column within the line where a data item is located. Each character in a line represents a column, with each line having 472 columns.
  • size: The number of columns used to represent a particular data item.
@bgourlie
bgourlie / StackOverflowReproDoesntCrash.elm
Created January 15, 2017 18:50
Attempting minimal reproduction of a stackoverflow error with elm's debugger
import Html exposing (p, text, div, canvas, Html)
import Html.Attributes exposing (id, style)
import Html.Events exposing (..)
import List exposing (repeat, concat)
import Array exposing (Array, fromList)
import Color exposing (rgb, Color)
import Debug exposing (log)
main =
package org.rust.ide
import com.intellij.codeInsight.completion.*
import com.intellij.codeInsight.lookup.LookupElementBuilder
import com.intellij.patterns.PlatformPatterns
import com.intellij.util.ProcessingContext
import org.rust.lang.RustLanguage
import org.rust.lang.core.psi.RustOuterAttrElement
class DeriveCompletionContributor : CompletionContributor() {
@bgourlie
bgourlie / .tmux.conf
Created June 24, 2015 17:36
tmux config
# make tmux display things in 256 colors
#
# Note: this may cause some wierdness when connected to remote sessions
# that don't use/support 256 colors. Namely, backspaces emit junk
# characters, but still work.
set -g default-terminal "screen-256color"
# map Vi movement keys as pane movement keys
bind h select-pane -L
bind j select-pane -D
@bgourlie
bgourlie / PivotPartition.cs
Last active August 29, 2015 14:17
Partition around in a pivot in O(N) time and memory
using System;
using System.Linq;
class Something
{
public static void Main(string[] args)
{
var blah = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
PrintArray(blah);
Partition(blah, 9);
@bgourlie
bgourlie / mergesort.dart
Last active August 29, 2015 14:16
Implementation of mergesort in dart
void main() {
final l1 = [1,3,5,9,11, 23,201,202];
final l2 = [2,2,3,9,10,300,301,415,500];
final a = new List<int>(l1.length + l2.length);
_merge(l1, l2, a);
print(a);
final sorted = [99,54,10534,42,9,2,4,4,23,54,62,88,33,101,1,2,2,1,7,4,77,6,143];
mergeSort(sorted);
print(sorted);
@bgourlie
bgourlie / git.dart
Last active August 29, 2015 14:11
dart script for getting git info
import 'dart:io';
import 'dart:async';
void main() {
//getCurrentBranch(r'C:\Users\wgi7748\Desktop\noBS').then((output) => print(output));
getHistory(r'C:\Users\wgi7748\Desktop\noBS', 3).then((entries) {
assert(entries.length == 3);
entries.forEach((e)
=> print('${e.author}: ${e.commitMessage} (${e.date})'));
});
@bgourlie
bgourlie / damerau_levenshtein.dart
Last active August 29, 2015 14:11
Damerau-Levenshtein distance algo implemented in dart
// Based on c# implementation here: http://stackoverflow.com/questions/12027324/damerau-levenshtein-distance-algorithm-disable-counting-of-delete
import 'dart:typed_data';
void main() {
final testFunction = distance4;
const WARMUP_ITERATIONS = 1000;
const RUN_ITERATIONS = 1000000;
const SOURCE = 'The quick brown fox jumped over the lazy dog.';
const TARGET = 'Teh Qiuck bronw fox jump over the lzy dog';
final stopwatch = new Stopwatch();
# change kre alias
kvm alias default -x86 1.0.0-beta1