Skip to content

Instantly share code, notes, and snippets.

View unhammer's full-sized avatar
kevin :: Coffee → Code

Kevin Brubeck Unhammer unhammer

kevin :: Coffee → Code
View GitHub Profile
open Batteries
let list_remove_all = flip List.remove_all (* stupid default arg order *)
let chop_glyphs acct =
String.explode acct
|> List.nsplit (Char.equal '\n')
|> list_remove_all []
|> List.map (List.ntake 3)
|> List.transpose
# let pred =
Array.init 100 (fun r ->
let a = n1 () in
let b = n1 () in
let c = a +. b in (* Makes the third column/predictor redundant and our data collinear! *)
[|a;b;c|]) ;;
val pred : float array array =
[|[|2.1000; 0.9001; 3.0001|]; [|1.7343; 2.9934; 4.7277|]; [|2.7644; 4.0290; 6.7935|];
[|0.7972; 2.6754; 3.4726|]; [|0.6089; 2.7250; 3.3340|]; [|0.7870; 2.7721; 3.5592|];
...|]
@unhammer
unhammer / fullexample.eliom
Last active August 29, 2015 14:28
run basic eliom-distillery and replace the .eliom with this
{shared{
open Eliom_lib
open Eliom_content
open Html5.D
type thing = string list deriving (Json)
let thing_json = Json.t<thing>
type stuff = A | B deriving (Json)
let stuff_json = Json.t<stuff>
@unhammer
unhammer / x
Created March 8, 2009 16:08
ubiquity: flickr original sizes
// @source: http://gist.github.com/75820
/*
@licstart The following is the entire license notice for the
Javascript code in this page.
Copyright (C) 2009 Kevin Brubeck Unhammer
The Javascript code in this page is free software: you can
redistribute it and/or modify it under the terms of the GNU
Index: source/java/writer2latex/latex/InlineConverter.java
===================================================================
--- source/java/writer2latex/latex/InlineConverter.java (revision 71)
+++ source/java/writer2latex/latex/InlineConverter.java (working copy)
@@ -195,7 +195,17 @@
case Node.TEXT_NODE:
String s = childNode.getNodeValue();
if (s.length() > 0) {
- ldp.append(palette.getI18n().convert(s, false, oc.getLang()));
+ if (oc.isZoteroText()) {
@unhammer
unhammer / lyz.writer2latex.patch
Created August 27, 2010 08:27
writer2latex patch for LyZ
=== modified file 'chrome/content/lyz/lyz.js'
--- old/chrome/content/lyz/lyz.js 2010-06-20 01:25:54 +0000
+++ new/chrome/content/lyz/lyz.js 2010-08-27 08:05:37 +0000
@@ -265,7 +265,7 @@
},
- createCiteKey: function(id,text,bib){
+ createCiteKey: function(id,text,bib,obj_key){
var win = this.wm.getMostRecentWindow("navigator:browser");
<?xml version="1.0" encoding="UTF-8"?>
<config>
<option name="inputencoding" value="utf8" />
<option name="documentclass" value="report" />
<option name="global_options" value="a4paper,11pt,norsk" />
<option name="use_bibtex" value="true" />
<option name="bibtex_style" value="apalike" />
<option name="bibtex_external_bibtex_files" value="true" />
<option name="page_formatting" value="ignore_all" />
<option name="ignore_empty_paragraphs" value="true" />
#!/bin/sh
## Endre desse variablane:
W2LJAR=/home/brukar/latex/writer2latex.jar
CONFIG=/home/brukar/latex/zotero.xml
BIB=/home/brukar/latex/minbibliografi # utan .bib til slutt
STYLE=apalike
## Du skal ikkje trenge endre noko under denne linja
if [ "$#" -ne 1 ]; then echo "Bruk: sh odt-to-lyx.sh dokument.odt"; exit 1; fi
@unhammer
unhammer / pylibtextcat.arch.patch
Created December 16, 2010 14:52
patch to make pylibtextcat run on Arch Linux
diff -rupN original/pylibtextcat-0.1//libtextcat.c pylibtextcat-0.1//libtextcat.c
--- original/pylibtextcat-0.1//libtextcat.c 2008-06-18 01:26:04.000000000 +0200
+++ pylibtextcat-0.1//libtextcat.c 2010-12-16 15:35:27.560001525 +0100
@@ -1,4 +1,4 @@
-#include <libtextcat/textcat.h>
+#include <textcat.h>
#include "libtextcat.h"
static const char __author__[] =
@@ -32,7 +32,7 @@ libTextCat_init(libTextCatObject *self,
@unhammer
unhammer / rhyme.sh
Created September 22, 2011 11:44
8 character rhyming words, only first letter change
#!/bin/bash
awk 'length($0)==8' /usr/share/dict/words|rev|sort -u|rev >/tmp/rsorted
tail -n+1 /tmp/rsorted >/tmp/1
tail -n+2 /tmp/rsorted >/tmp/2
paste -d: /tmp/1 /tmp/2|grep '^.\(.*\):.\1$'