This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ nixpkgs ? import <nixpkgs> {} | |
}: | |
let | |
inherit (nixpkgs) pkgs; | |
python = let | |
packageOverrides = self: super: { | |
# sklearn tests fail on darwin | |
scikitlearn = super.scikitlearn.overridePythonAttrs(old: rec { | |
doCheck = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Not the greatest Haskell code, but it's possible to create a `i -> AccValidation err a` type | |
-- that can keep help keep track of where errors are. | |
-- For aeson, may be possible to just put the `[(Text, Value)]`s in place of `[String]`? | |
-- e.g. * Replace `[String] -> AccValidation [VError] a` with `[(Text, Value)] -> AccValidation [VError] a` | |
-- where `Text` is the key name, and `Value` is the value being parsed | |
-- * Make the smart constructor also take in a `Value` so it can `<>` the data. | |
-- * `VError` would need to be parameterized too to accept `Value` instead of `String` | |
-- May not be useful, and please ignore the bad code for now. D: I'm tired. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# 2011-10-10 20:57:53 +1000 | |
def merge_sort(a) | |
return a if a.size <= 1 | |
l, r = split_array(a) | |
result = combine(merge_sort(l), merge_sort(r)) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# NAME | |
# dirwatch - run command on file modification | |
# | |
# SYNOPSIS | |
# dirwatch [-m marker] command dir ... | |
# | |
# DESCRIPTION | |
# dirwatch uses a touch file to track whether files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ¿ | |
puts 'IMA UPSIDEDOWN QUESTIONMARK LOL' | |
end | |
¿ # => IMA UPSIDEDOWN QUESTIONMARK LOL | |
¿ # => IMA UPSIDEDOWN QUESTIONMARK LOL | |
¿ # => IMA UPSIDEDOWN QUESTIONMARK LOL | |
¿ # => IMA UPSIDEDOWN QUESTIONMARK LOL | |
¿ # => IMA UPSIDEDOWN QUESTIONMARK LOL | |
¿ # => IMA UPSIDEDOWN QUESTIONMARK LOL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git config --global alias.lg "log --date=relative --since='1 week ago' --pretty --graph" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def assign_nesting_resources | |
@hammock_nesting_scopes.map {|scope| | |
scope.kick | |
}.confirm {|kicked_scopes| | |
kicked_scopes.all? { |results| results.length == 1 } | |
}.map { |kicked_scopes| | |
kicked_scopes.map {|results| | |
results.first | |
}.each {|result| | |
assign_entity result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def number_to_ordinal num | |
int = num.to_i | |
if (10...20) === int | |
"#{int}th" | |
else | |
"#{int}#{%w{ th st nd rd th th th th th th }[int % 10]}" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PedAssignOptions < Struct.new(:links_file, :access_file, :walk_int_file, :output_file); end | |
class ParseFail < Struct.new(:reason); end | |
class ArgvParser | |
def parse argv | |
if argv.size == 1 and ['-h','--help'].include? argv.first then | |
return :help | |
end | |
if argv.length != PedAssignOptions.members.size then | |
return ParseFail.new("Incorrect number of arguments, got #{argv.size} expected #{PedAssignOptions.members.size}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$s = Time.now | |
$logger = Object.new | |
def $logger.method_missing(sym, *args) | |
puts "[%s, %.3f] %s" % [sym.to_s.upcase, Time.now - $s, args.join(' ')] | |
end | |
NewerOlder