Skip to content

Instantly share code, notes, and snippets.

@rnelson
rnelson / day02.fs
Created December 10, 2017 13:49
Attempts at AoC 2017 Day 2b
open System
open System.IO
open System.Linq
open System.Text.RegularExpressions
let readInput(filename:string) =
let lines = File.ReadAllLines filename
[|
for l in (lines |> Array.toSeq) do
yield Regex.Split(l, "\s+") |> Array.map int
@rnelson
rnelson / tsinstall.bash
Created November 26, 2017 13:56
Script to install Tarsnap
#!/bin/bash
set -e
ROOT=/opt/tarsnap
usage() {
echo "usage: $0 <version>"
exit 1
}
@rnelson
rnelson / free_oreilly_ebooks.sh
Created October 10, 2016 11:48
O'Reilly Gives Away Free Programming Ebooks
#!/bin/sh
# http://www.oreilly.com/programming/free/
# https://news.slashdot.org/comments.pl?sid=9752765&cid=53044369
# https://news.slashdot.org/comments.pl?sid=9752765&cid=53045853
curl 'http://www.oreilly.com/business/free/' | grep '\.csp' | sed 's/^.*href="//' | sed 's/free\/\(.*\).csp.*">/free\/files\/\1.pdf/' | tr -d '\r' | xargs wget
curl 'http://www.oreilly.com/data/free/' | grep '\.csp' | sed 's/^.*href="//' | sed 's/free\/\(.*\).csp.*">/free\/files\/\1.pdf/' | tr -d '\r' | xargs wget
curl 'http://www.oreilly.com/design/free/' | grep '\.csp' | sed 's/^.*href="//' | sed 's/free\/\(.*\).csp.*">/free\/files\/\1.pdf/' | tr -d '\r' | xargs wget
curl 'http://www.oreilly.com/iot/free/' | grep '\.csp' | sed 's/^.*href="//' | sed 's/free\/\(.*\).csp.*">/free\/files\/\1.pdf/' | tr -d '\r' | xargs wget
curl 'http://www.oreilly.com/programming/free/' | grep '\.csp' | sed 's/^.*href="//' | sed 's/free\/\(.*\).csp.*">/free\/files\/\1.pdf/' | tr -d '\r' | xargs wget
using UnsignedInteger = System.UInt16; // Sorry, I can't unabbreviate it on the RHS
// https://twitter.com/taylonr/status/712277308363542530
namespace FizzBuzz
{
class Program
{
static void Main(System.String[] arguments)
{
@rnelson
rnelson / input.xml
Last active August 31, 2020 10:16
Tokenize a string in XSLT 1
<?xml version="1.0" encoding="UTF-8"?>
<input fields="One|Two|Three|Four|Five|Agree" values="Answer A|Answer B|Answer C|Answer D|Answer E|Yes"/>
@rnelson
rnelson / .gitignore
Last active August 29, 2015 14:17 — forked from adamcooke/cloudapp-export.rb
cloudapp-export
cloudapp-export
@rnelson
rnelson / togglpie.R
Last active August 29, 2015 14:16
togglpie - build a pie chart from toggl.com CSV export showing percentage of time spent on projects
#!/usr/bin/env Rscript
#
# usage: ./togglpie.R Toggl_projects_2015-03-09_to_2015-03-15.csv week12.png
#
# Change "YOUR CLIENT HERE" to the name of the client. To do all clients,
# remove the if statement (leaving the two lines in the body)
# Read the command line arguments
args <- commandArgs(trailingOnly = TRUE)
input = args[1]
@rnelson
rnelson / keybase.md
Created September 26, 2014 14:12
Keybase Proof

Keybase proof

I hereby claim:

  • I am rnelson on github.
  • I am rnelson (https://keybase.io/rnelson) on keybase.
  • I have a public key whose fingerprint is 67E8 A82D C27A B497 3F5D 377F 33E5 C81B 04CA DCBA

To claim this, I am signing this object:

@rnelson
rnelson / Install QGIS on OS X.md
Created July 31, 2014 20:48
Install QGIS on OS X

Installing QGIS on OS X

Introduction

These instructions cover installing QGIS on OS X. Note that OS X 10.7 (Lion) is the minimum supported version.

Step 1: Download installers

You will need 3 separate installers to get QGIS onto your computer. They can be found from the QGIS download page, or you can click the following links:

@rnelson
rnelson / nelsonr_assign4.cpp
Created July 21, 2014 14:15
CSC 250 Assignment 4
// Ross Nelson
// Assignment 4
// nelsonr_assgn4.cpp
// Assigned: 11 Feb 2004
// Due: 18 Feb 2004
//
// assgn4 dynamically allocates an array, reads values from
// a file, and finds the mode and median of the values
//
// Return Values: