Skip to content

Instantly share code, notes, and snippets.

Avatar
kevin :: Coffee → Code

Kevin Brubeck Unhammer unhammer

kevin :: Coffee → Code
View GitHub Profile
@unhammer
unhammer / x
Created Mar 8, 2009
ubiquity: flickr original sizes
View x
// @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
View writer2latex4zotero.diff
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 Aug 27, 2010
writer2latex patch for LyZ
View lyz.writer2latex.patch
=== 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");
View zotero-apa.xml
<?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" />
View odt-to-lyx.sh
#!/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 Dec 16, 2010
patch to make pylibtextcat run on Arch Linux
View pylibtextcat.arch.patch
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 Sep 22, 2011
8 character rhyming words, only first letter change
View rhyme.sh
#!/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$'
@unhammer
unhammer / gwene-bookmarklet.html
Created Sep 29, 2011
make adding gwene feeds _slightly_ faster
View gwene-bookmarklet.html
<html>
<body>
<a href="javascript:
var f = document.createElement('form');
f.setAttribute('method', 'post');
f.setAttribute('action', 'http://gwene.org/');
var i = document.createElement('input');
i.setAttribute('type', 'hidden');
i.setAttribute('name', 'url');
i.setAttribute('value', location.href);
@unhammer
unhammer / decode-html-entities.py
Created Oct 13, 2011
decode html entities from stdin, utf-8
View decode-html-entities.py
#!/usr/bin/env python2
import sys, codecs;
sys.stdin = codecs.getreader('utf-8')(sys.stdin);
sys.stdout = codecs.getwriter('utf-8')(sys.stdout);
sys.stderr = codecs.getwriter('utf-8')(sys.stderr);
import HTMLParser
h = HTMLParser.HTMLParser()
@unhammer
unhammer / wdiffc.sh
Created Jan 5, 2012
helper to dwdiff
View wdiffc.sh
#!/bin/bash
# Default -c on if stdout is a terminal:
if [ -t 1 ]; then C='-c';
else C=; fi
# Assume --diff-input if stdin is not a terminal:
if [ -t 0 ]; then DI=
else DI='--diff-input'; fi