Skip to content

Instantly share code, notes, and snippets.

View cbilson's full-sized avatar

Chris Bilson cbilson

View GitHub Profile
Date,USDEUR
2010-07-02,1.2548
2010-07-01,1.2328
2010-06-30,1.2271
2010-06-29,1.2198
2010-06-28,1.2339
2010-06-25,1.2294
2010-06-24,1.2262
2010-06-23,1.2271
2010-06-22,1.2258
cd 'C:\Program Files (x86)\Git\doc\git\html'; ls *.html | ?{$_.Name -match '\w+-\w+\.*'} | %{mv $_ $($_.Name.Replace('-', ''))}
;; I came up with this after reading http://stackoverflow.com/questions/1009037/processing-pairs-of-values-from-two-sequences-in-clojure
(defn nseq-map
"Given keys and sequences of values, produces a sequence of
maps of the keys to each slice of values from the sequences.
Example:
user> (nseq-map [:a :b :c] [1 2 3] [\"ba\" \"bb\" \"bc\"] [\"cx\" \"cy\" \"cz\"])
({:c \"cx\", :b \"ba\", :a 1} {:c \"cy\", :b \"bb\", :a 2} {:c \"cz\", :b \"bc\", :a 3})"
[keys & value-seqs]
@cbilson
cbilson / fastnav.el
Created June 23, 2011 19:56
My bastarded up fastnav - unfortunately the suggested key bindings conflict with paredit, so not using for now (until I can come up with a scheme that works for me)
;; fastnav.el -- Fast navigation and editing routines.
;;
;; Version 1.05
;;
;; Copyright (C) 2008, 2009, 2010 Zsolt Terek <[email protected]>
;;
;; Compatibility: GNU Emacs 22, 23.
;;
;; Inspired by zap-to-char, this library defines different routines operating on
;; the next/previous N'th occurrence of a character. When invoking one of these
@cbilson
cbilson / psake-compile.el
Created July 8, 2011 14:17
I want to use psake to compile things in emacs
(defun set-psake-compile-command ()
(interactive)
(let ((psake-file-dir (locate-dominating-file (buffer-file-name) "default.ps1")))
(if psake-file-dir
(let (( psake-command (concat "Set-Location " psake-file-dir "; & c:\\Dropbox\\bin\\psake.ps1")))
(progn
(make-local-variable 'compile-command)
(setq compile-command
(concat "powershell -NoProfile -ExecutionPolicy unrestricted -Command \"" psake-command "\"")))))))
@cbilson
cbilson / Foo.ps1
Created October 24, 2011 18:45
Was going to do this to recompile all our coffee scripts when they change, but found a better way
task Start-Coffee-Watcher -Description "when a coffee file changes recompile - for testing" {
Start-Job -Name "CoffeeWatcher" -ArgumentList "$srcDir\WebRole\scripts" -ScriptBlock {
param($scriptsFolder)
Write-Host "Watching $scriptsFolder"
$recompile = {
# TODO: Figure out how to recompile coffee scripts from command line with SassAndCoffee
@cbilson
cbilson / New-CurryAlias.ps1
Created February 8, 2012 18:31
A function that creates aliases with arguments curried in
function global:New-CurryAlias($name, $value) {
$wrapperFunctionName = "Invoke-Curried-$name"
$wrapperFunctionPath = "function:global:$wrapperFunctionName"
Set-Item -Force -Path $wrapperFunctionPath `
-Value "Invoke-Expression -Command '$value $args'"
New-Alias -Force -Name $name -Value $wrapperFunctionName
}
@cbilson
cbilson / test_helpers.clj
Created March 2, 2012 03:15
My lame roughly macro for clojure.test. Sucks? Rocks?
(ns model-trainer.test.helpers
(:use [model-trainer.math :only [msum mabs msubtract rvec matrix]]
[clojure.test])
(:import [cern.colt.matrix DoubleMatrix2D DoubleMatrix1D]))
;; usage
#_(deftest computing-activations
;; this tests computing activation for a layer in a multi-layer perceptron,
;; basically: multiply rvec by matrix and apply the sigmoid activation function to
;; constrain the values to the 0 to 1 range. The result should be the first vector.
using MyApp.Models, MyApp.Util, MyApp.Widgets, (ctx) =>
class MyApp.Reports
@request: (...) =>
# given MyApp.Util has an `ajaxRequest` method, for example
ctx.ajaxRequest ...
@cbilson
cbilson / hack.sh
Created April 5, 2012 09:51 — forked from makevoid/hack.sh
OSX For Hackers
#!/usr/bin/env sh
echo "Use current directory as default search scope in Finder"
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
echo "Show Path bar in Finder"
defaults write com.apple.finder ShowPathbar -bool true
echo "Disable the Ping sidebar in iTunes"
defaults write com.apple.iTunes disablePingSidebar -bool true