Skip to content

Instantly share code, notes, and snippets.

View tsdh's full-sized avatar

Tassilo Horn tsdh

View GitHub Profile
@tsdh
tsdh / CSV-AsSqlList-Groovy.csv.groovy
Created February 7, 2019 12:03
IntelliJ Table Data Extractor extracting a (or multiple if many columns are selected) SQL lists
/*
* Available context bindings:
* COLUMNS List<DataColumn>
* ROWS Iterable<DataRow>
* OUT { append() }
* FORMATTER { format(row, col); formatValue(Object, col) }
* TRANSPOSED Boolean
* plus ALL_COLUMNS, TABLE, DIALECT
*
* where:

Keybase proof

I hereby claim:

  • I am tsdh on github.
  • I am tsdh (https://keybase.io/tsdh) on keybase.
  • I have a public key ASAu7WtVgWk5KaQengQglBkSyUZVbs7QexKqACtaM5UHigo

To claim this, I am signing this object:

@tsdh
tsdh / gist:8314450
Created January 8, 2014 10:03
A Clojure solution to Xah Lee's programming challenge "Constructing a Tree Given Its Edges".
(defn parent-children-map
"Converts a vector of [child parent] edges into a map where every entry has
the form [parent set-of-children].
Examples:
(parent-children-map [[0, 2], [3, 0], [1, 4], [2, 4]])
;=> {4 #{1 2}, 0 #{3}, 2 #{0}}
(parent-children-map [[10 1] [1 4] [6 1] [8 6] [9 5] [2 4]
@tsdh
tsdh / gist:6492130
Created September 9, 2013 06:30
The result of exporting https://gist.github.com/tsdh/6492120 to html using org-reveal.
<link rel="stylesheet" href="file:///home/horn/Repos/js/reveal.js/css/print/pdf.css" type="text/css" media="print">
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<h1>This is the title</h1>
<h2>Tassilo Horn</h2>
<h2><a href="mailto:me@home">me@home</a></h2>
<h2></h2></section>
@tsdh
tsdh / gist:6492120
Created September 9, 2013 06:28
A minimal org sample presentation
#+AUTHOR: Tassilo Horn
#+EMAIL: me@home
#+TITLE: This is the title
* Ex.: Relational Querying
#+BEGIN_HTML
<center><table width="40%"><tr><td>
#+END_HTML
#+BEGIN_SRC clojure
From 69a786ad268c83df30b5c30c5ad23630b17a0aaa Mon Sep 17 00:00:00 2001
From: Tassilo Horn <tsdh@gnu.org>
Date: Tue, 7 May 2013 12:15:40 +0200
Subject: [PATCH] Handle undefined face. (fixes #31)
---
powerline-separators.el | 41 ++++++++++++++++++-----------------------
1 file changed, 18 insertions(+), 23 deletions(-)
diff --git a/powerline-separators.el b/powerline-separators.el
@tsdh
tsdh / r-reduce.clj
Created June 11, 2012 06:44 — forked from kohyama/example-to-use-r-reduce.clj
R-reduce is an variant of reduce-right which accepts a condition to stop. In Clojure.
; Using this 'r-reduce',
; you can write calculations having same structure
; as 'take', 'drop', 'take-while', 'drop-while', 'fold-right' and 'reduce-right'
; without writing loops explicitly.
(use 'clojure.test)
; Accumulate what calculations should be done into acc.
; When stopping reversing acc and apply it.
(defn r-reduce [init updt pred retn f coll]
From 6cc333965001a99fa6bc6f7bd32c731a00fb33fc Mon Sep 17 00:00:00 2001
From: Tassilo Horn <horn@uni-koblenz.de>
Date: Fri, 9 Mar 2012 12:33:34 +0100
Subject: [PATCH] Add LinkedHashPSet and make POrderedSets returs POrderedSets
again.
---
src/org/pcollections/ArrayPSet.java | 20 ++--
src/org/pcollections/LinkedHashPSet.java | 165 ++++++++++++++++++++++++++++++
src/org/pcollections/OrderedPSet.java | 12 +-
class LinkedHashPOrderedSet implements POrderedSet {
LinkedHashSet lhs;
POrderedSet pos;
LinkedHashPOrderedSet(LinkedHashSet l) {
lhs = l;
pos = OrderedPSet.empty();
}
LinkedHashPOrderedSet(LinkedHashSet l, POrderedSet p) {
lhs = l;
pos = p;
(defmacro timing
"Times the execution of `form' and returns its result.
Additionally, prints (format fmt args), where two new formatters are
available:
%T: the timing information (e.g., 1.71827 msecs)
%R: the result of evaluating `expr'
%F: the input form that is timed
Example: