Skip to content

Instantly share code, notes, and snippets.


Jürgen Hötzel juergenhoetzel

View GitHub Profile
juergenhoetzel /
Last active April 16, 2023 09:50
List starred Github repos in Shell (curl + jq)
while curl -s "$user/starred?per_page=100&page=${page:-1}" \
|jq -r -e '.[].full_name' && [[ ${PIPESTATUS[1]} != 4 ]]; do
let page++
juergenhoetzel / getstarred.ps1
Last active August 3, 2022 20:26
List starred Github repos in Powershell
View getstarred.ps1
$user = "juergenhoetzel"
$p = 1
do {
$full_names = Invoke-RestMethod "$user/starred?per_page=100&page=$p"
} while ($full_names.Length -gt 0)
juergenhoetzel / b64_encode_decode.c
Created December 12, 2020 14:32
Base64 encoding and decoding using OpenSSL
View b64_encode_decode.c
// Encodes Base64
#include <openssl/bio.h>
#include <openssl/buffer.h>
#include <openssl/evp.h>
#include <stdint.h>
// Decodes Base64
#include <assert.h>
#include <openssl/bio.h>
#include <openssl/evp.h>
#include <stdint.h>
juergenhoetzel / utf16.go
Created December 8, 2018 09:43
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 March 13, 2018 19:27
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:

juergenhoetzel / db.clj
Created August 22, 2012 12:13
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 June 19, 2012 18:11
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 14:55
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))