Skip to content

Instantly share code, notes, and snippets.


Jürgen Hötzel juergenhoetzel

Block or report user

Report or block juergenhoetzel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
juergenhoetzel / utf16.go
Created Dec 8, 2018
Decode utf16 (little or big endian) to string
View utf16.go
package main
import (
func DecodeUtf16(b []byte, order binary.ByteOrder) (string, error) {
juergenhoetzel / go-find-external.el
Created Mar 13, 2018
Faster external package indexing for go-mode
View go-find-external.el
(defun go-packages-find ()
(cl-mapcan (lambda (topdir)
(let ((pkgdir (concat topdir "/pkg")))
(mapcar (lambda (file)
(let ((sub (substring file 0 -2)))
(mapconcat #'identity (cdr (split-string sub "/")) "/")))
(split-string (shell-command-to-string
(format "find \"%s\" -not -path \"%s/tool*\" -not -path \"%s/obj/*\" -name \"*.a\" -printf \"%%P\\n\""
View .bash
# emojify completion -*- shell-script -*-
local cur
_get_comp_words_by_ref -n : cur
COMPREPLY=( $(compgen -W "${_emojis[*]}" -- ${cur}) )
__ltrim_colon_completions "$cur"
# sanity checks

Keybase proof

I hereby claim:

  • I am juergenhoetzel on github.
  • I am juergenhoetzel ( on keybase.
  • I have a public key whose fingerprint is 355B DB97 ED47 24E6 B3A4 50E7 A3D9 562A 5898 74AB

To claim this, I am signing this object:

View db.clj
(defn get-user [handle]
(sql/with-connection db
(sql/with-query-results rs ["select * from users where handle=?" handle] (first rs))))
juergenhoetzel /
Created Jun 19, 2012
Neo4J in Action (revised CustomFilteringEvaluator)
import org.neo4j.graphdb.traversal.Evaluator;
import org.neo4j.graphdb.traversal.Evaluation;
import org.neo4j.graphdb.*;
// exclude Movies seen by userNode
public class CustomFilteringEvaluator implements Evaluator {
private RelationshipType hasSeenRelationshipType = DynamicRelationshipType.withName("HAS_SEEN");
private final Node userNode;
public CustomFilteringEvaluator(Node userNode) {
this.userNode = userNode;
juergenhoetzel / account.clj
Created May 3, 2012
Well-Grounded Java Developer: Account example revised
View account.clj
(defn make-account [name balance]
{:name name :balance balance})
(defn withdraw [account n]
(update-in account [:balance] - n))
; Single-Treaded withdraw/loop
(loop [a (make-account "Ben" 5000)]
(Thread/sleep 1)
(if (pos? (:balance a))
juergenhoetzel / slime-cygwin.el
Created Apr 17, 2012
Slime Windows-Unix-Path translation (Cygwin)
View slime-cygwin.el
(require 'clojure-mode "clojure-mode" t)
(require 'slime t)
(when (eq system-type 'cygwin)
(add-hook 'slime-connected-hook (lambda ()
(setq slime-to-lisp-filename-function (lambda (filename)
"\n" "" (shell-command-to-string
(format "cygpath.exe --windows %s" filename))))
slime-from-lisp-filename-function (lambda (filename)
View window-rotate.el
(require 'cl)
(defun rotate-left (l) (append (cdr l) (list (car l))))
(defun rotate-windows ()
(let ((start-positions (rotate-left (mapcar 'window-start (window-list))))
(buffers (rotate-left (mapcar 'window-buffer (window-list)))))
(mapcar* (lambda (window buffer pos)
(set-window-buffer window buffer)
(set-window-start window pos))
juergenhoetzel / reopen-sudo.el
Created May 11, 2011
Reopen file visited in current buffer using tramp-sudo
View reopen-sudo.el
(defun reopen-sudo ()
(unless (file-remote-p (buffer-file-name))
(find-file (tramp-make-tramp-file-name "sudo" "root" "localhost" (buffer-file-name)))))
You can’t perform that action at this time.