Skip to content

Instantly share code, notes, and snippets.

@pstephens
pstephens / gist:71ec249757941f9c01ca
Created October 21, 2014 01:55
Problem running Optimus on Windows
PS C:\src> lein ring server
Exception in thread "main" java.lang.Exception: Unsupported OS/archetype: Windows 8.1 amd64, compiling:(v8/core.clj:34:2
6)
at clojure.lang.Compiler.load(Compiler.java:7142)
at clojure.lang.RT.loadResourceScript(RT.java:370)
at clojure.lang.RT.loadResourceScript(RT.java:361)
at clojure.lang.RT.load(RT.java:440)
at clojure.lang.RT.load(RT.java:411)
at clojure.core$load$fn__5066.invoke(core.clj:5641)
at clojure.core$load.doInvoke(core.clj:5640)
@pstephens
pstephens / sort.erl
Created October 9, 2014 01:24
Naive qsort in Erlang.
-module(sort).
-export([qsort/1]).
%%% A slightly naive implementation. But at least it does partial TCO.
partition(_, [], Smaller, Equal, Larger) -> {Smaller, Equal, Larger};
partition(Pivot, [H|T], Smaller, Equal, Larger) when H < Pivot -> partition(Pivot, T, [H|Smaller], Equal, Larger);
partition(Pivot, [H|T], Smaller, Equal, Larger) when H =:= Pivot -> partition(Pivot, T, Smaller, [H|Equal], Larger);
partition(Pivot, [H|T], Smaller, Equal, Larger) when H > Pivot -> partition(Pivot, T, Smaller, Equal, [H|Larger]).
@pstephens
pstephens / Program.fs
Created August 17, 2014 15:25
Fun with F# and bulk copy
// Fun with F# and bulk copy
open System.Configuration
open System.Data
open System.Data.SqlClient
let getOpenConnection () =
let cn = new SqlConnection(ConfigurationManager.ConnectionStrings.["TdsScratch"].ConnectionString)
cn.Open ()
cn
JSON:
[
{
international_date: false,
is_coed: false,
team_name: "foo bar"
},
{
international_date: false,
is_coed: false,
@pstephens
pstephens / console-logs.txt
Last active January 4, 2016 09:19
Can't create a new virtual machine in VMWare Fusion 6.0.2.
1/24/14 11:13:17.808 AM VMware Fusion[939]: -[NSViewController loadView] loaded the "plVMDKOpenHelper" nib but no view was set.
1/24/14 11:13:17.809 AM VMware Fusion[939]: (
0 CoreFoundation 0x00007fff87d9741c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff8775de75 objc_exception_throw + 43
2 CoreFoundation 0x00007fff87d972cc +[NSException raise:format:] + 204
3 AppKit 0x00007fff88169507 -[NSViewController loadView] + 361
4 VMware Fusion 0x00000001079ca47f VMware Fusion + 152703
5 VMware Fusion 0x0000000107a5e0e7 VMware Fusion + 757991
6 VMware Fusion 0x0000000107a5dfe1 VMware Fusion + 757729
7 VMware Fusion 0x0000000107c0c2dc _ZN3cui19VMConfigTransaction3SetINS_16VMConfigPolicies16PolicyProtectionEEEvRNS_19TransactionPropertyIT_S0_EERKS5_ + 286956
@pstephens
pstephens / dir.js
Last active January 4, 2016 07:59
Recursively get a list of files given a starting path.
var _ = require('underscore');
var fs = require('fs');
var path = require('path');
var Q = require('Q');
function processFileAsync(context)
{
return Q.ninvoke(fs, "stat", context.path)
.then(function(stat) {
@pstephens
pstephens / GetNode.ps1
Last active December 28, 2015 06:59
Node.js bootstrapper in PowerShell.
$nodeUrl = "http://nodejs.org/dist/v0.10.22/x64/node-v0.10.22-x64.msi"
$nodeSha = "c3c169304c6371ee7bd119151bcbced61a322394"
function DownloadIt($url, $path)
{
Start-BitsTransfer -Source $url -Destination $path
}
function TestHash($path, $sha)
{