Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Jürgen Hötzel juergenhoetzel

🎯
Focusing
View GitHub Profile
@juergenhoetzel
juergenhoetzel / getstarred.ps1
Last active Aug 3, 2022
List starred Github repos in Powershell
View getstarred.ps1
$user = "juergenhoetzel"
$p = 1
do {
$full_names = Invoke-RestMethod "https://api.github.com/users/$user/starred?per_page=100&page=$p"
$full_names.ForEach({$_.full_name})
$p++
} while ($full_names.Length -gt 0)
@juergenhoetzel
juergenhoetzel / b64_encode_decode.c
Created Dec 12, 2020
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
juergenhoetzel / getstarred.sh
Last active Jul 2, 2022
List starred Github repos in Shell (curl + jq)
View getstarred.sh
user=juergenhoetzel
while curl -s "https://api.github.com/users/$user/starred?per_page=100&page=${page:-1}" \
|jq -r -e '.[].full_name' && [[ ${PIPESTATUS[1]} != 4 ]]; do
let page++
done
@juergenhoetzel
juergenhoetzel / utf16.go
Created Dec 8, 2018
Decode utf16 (little or big endian) to string
View utf16.go
package main
import (
"bytes"
"encoding/binary"
"fmt"
"unicode/utf16"
)
func DecodeUtf16(b []byte, order binary.ByteOrder) (string, error) {
@juergenhoetzel
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 ()
(sort
(delete-dups
(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 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))
(window-list)
@juergenhoetzel
juergenhoetzel / terminal-ssh-host-title.sh
Created Dec 22, 2010
Set Window Title using OpenSSHs LocalCommand
View terminal-ssh-host-title.sh
LocalCommand echo -ne "\033]0;"%r@%h"\007"
PermitLocalCommand yes
View .bash
# emojify completion -*- shell-script -*-
_emojify_complte(){
local cur
_get_comp_words_by_ref -n : cur
COMPREPLY=( $(compgen -W "${_emojis[*]}" -- ${cur}) )
__ltrim_colon_completions "$cur"
}
# sanity checks
View keybase.md

Keybase proof

I hereby claim:

  • I am juergenhoetzel on github.
  • I am juergenhoetzel (https://keybase.io/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))))