Skip to content

Instantly share code, notes, and snippets.

View ecounysis's full-sized avatar

Eric Christensen ecounysis

View GitHub Profile
@ecounysis
ecounysis / clojure-font-lock-setup.el
Created August 18, 2011 23:55 — forked from michalmarczyk/clojure-font-lock-setup.el
coloured SLIME REPL for Clojure
;;; all code in this function lifted from the clojure-mode function
;;; from clojure-mode.el
(defun clojure-font-lock-setup ()
(interactive)
(set (make-local-variable 'lisp-indent-function)
'clojure-indent-function)
(set (make-local-variable 'lisp-doc-string-elt-property)
'clojure-doc-string-elt)
(set (make-local-variable 'font-lock-multiline) t)
@ecounysis
ecounysis / whatever.clj
Created August 16, 2011 16:07
Learning Clojure
(require '[clojure.contrib.repl-utils :as repl])
(clojure.core/use 'clojure.core)
(ns books)
(defstruct book :author :title :year :rank)
(defmacro makebook [& vs]
`(struct-map book ~@vs))
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
source $VIMRUNTIME/eric_custom.vim
behave mswin
set ff="unix"
set encoding=utf-8
set nobinary
@ecounysis
ecounysis / gist.py
Created July 20, 2011 17:15
A Gist for Displaying Gists
import cgi
print "Content-Type: text/html"
print
form = cgi.FieldStorage()
if 'g' not in form:
out = ""
@ecounysis
ecounysis / black-scholes.vb
Created July 20, 2011 16:44
Black Scholes VBA module
Option Explicit
Private Function n(strike As Double, s As Double, sd As Double, r As Double, days As Double) As Double
Dim ls, lx, sd2, t As Double
ls = Log(s)
lx = Log(strike)
t = days / 365
sd2 = pow(sd, 2)
n = ls - lx + r * t + sd2 * t / 2
End Function
#!/usr/bin/env python
def twodigits(st):
g = st[2:]
if (len(g) == 1):
g = '0' + g
return g.upper()
def n2h(n):
r = hex(n)
@ecounysis
ecounysis / hackernews.pl
Created July 11, 2011 02:00
console tool for reading Hacker News
#!/usr/bin/env perl
use JSON;
use strict;
no warnings;
use HTML::Entities;
my $command = @ARGV[0];
my $home = $ENV{'HOME'};
if (not (-e "$home/.hn")) {
@ecounysis
ecounysis / bml.js
Created June 22, 2011 15:11
Bookmarklet to view embed from github
javascript:(function() {document.write('<script src="https://gist.github.com/1040276.js"> </script>') })()
// why not just do this?
@ecounysis
ecounysis / binsearch.c
Created June 22, 2011 15:01
Attempting to solve K&R exercise 3-1
#include <stdio.h>
#include <stdlib.h>
int binsearch1(int, int[], int);
int binsearch2(int, int[], int);
int main(int argc, char *argv[])
{
int size = atoi(argv[2]);
//&>/dev/null;x="${0%.*}";[ ! "$x" -ot "$0" ]||(rm -f "$x";cc -o "$x" "$0")&&"$x" $*;exit
#include <stdio.h>
int main() {
char c;
while ((c = getchar()) != EOF)
putchar(c);
return 0;
}