Skip to content

Instantly share code, notes, and snippets.

View Ferada's full-sized avatar
☀️
~\[T]/~

Olof-Joachim Frahm (欧雅福) Ferada

☀️
~\[T]/~
View GitHub Profile
@Ferada
Ferada / docker.lisp
Created February 18, 2023 08:24
Docker Engine API with SBCL, drakma & yason
(let ((socket (make-instance 'sb-bsd-sockets:local-socket :type :stream)))
(sb-bsd-sockets:socket-connect socket "/var/run/docker.sock")
(with-open-stream (stream (sb-bsd-sockets:socket-make-stream socket
:element-type '(unsigned-byte 8)
:input T
:output T
:buffering :none))
(let ((wrapped-stream (flexi-streams:make-flexi-stream (drakma::make-chunked-stream stream)
:external-format drakma::+latin-1+)))
(multiple-value-bind (first second third fourth fifth sixth seventh)
group gotools {
perm {
admin {
uid = UID;
gid = UID;
}
task {
uid = UID;
gid = UID;
}
;; c.f. <https://de.wikipedia.org/wiki/Steuerliche_Identifikationsnummer#Aufbau_der_Identifikationsnummer>
(defun check-steuer-id (id)
(let ((product 0))
(loop
with digits = (mapcar (lambda (digit) (parse-integer (string digit))) (coerce (format NIL "~D" id) 'list))
for i from 1 to 10
for digit = (elt digits (1- i))
for sum = (mod (+ digit product) 10)
when (zerop sum)

This is a quick guide to changing the keymap on the GH60 "Satan" or RevCHN. Note that the Satan is NOT a true GH60, and using the GH60 with the normal TMK would not work.

Note that installing dependencies or compiling TMK is not a part of the scope of this document. If you have problems with this part, seek help elsewhere. Not also that these instructions are written for Linux and Mac. If you're using windows, just use the Command Prompt for the git commands, and Windows Explorer to move and delete files.

  1. Dependencies.
  2. Download and install GIT: https://git-scm.com/downloads
  3. Download and install the dependencies for compiling TMK: https://github.com/tmk/tmk_keyboard/blob/master/doc/build.md (Point 1 only)
  4. Using git, download the TKG toolkit. https://github.com/kairyu/tkg-toolkit git clone git@github.com:kairyu/tkg-toolkit.git tkg
  5. Still using git, download Kairyu's fork of TMK. https://github.com/kairyu/tmk_keyboard_custom git@github.com:kairyu/tmk_keyboard_custom.git tmk
import java.lang.ref.ReferenceQueue
import java.lang.ref.WeakReference
import kotlin.concurrent.thread
class MyWeakReference<T>(val id: Int, p0: T, p1: ReferenceQueue<in T>?) : WeakReference<T>(p0, p1)
fun main() {
val queue = ReferenceQueue<Object>()
val upper = 10000000
val set = (1..upper).toMutableSet()
time go run timeoutreader.go http://www.example.com/ simple 1s >/dev/null
time go run timeoutreader.go http://www.example.com/ anything-but-simple 1s >/dev/null
time curl http://www.example.com/ >/dev/null
// ReadSeekerCloser combines a ReadSeeker with a Closer. Brilliant, isn't it.
type ReadSeekerCloser interface {
io.ReadSeeker
io.Closer
}
@Ferada
Ferada / izip_checked.py
Last active August 29, 2015 14:21
Checked Python izip variant.
class izip_checked(object):
def __init__(self, *args):
self._iterators = map(iter, args)
def __iter__(self):
if self._iterators:
return self
return iter([])
def next(self):
@Ferada
Ferada / keybase.md
Last active December 23, 2016 22:57
keybase.md

Keybase proof

I hereby claim:

  • I am Ferada on github.
  • I am ferada (https://keybase.io/ferada) on keybase.
  • I have a public key whose fingerprint is 8298 70B4 F2ED 83EE D9CA 701F AB09 10EE 7C36 342F

To claim this, I am signing this object:

% May 15 - May 16 - May 19
% June 17 - June 18
% July 14 - July 16
% August 14 - August 15 - August 17
% July 14 - July 16
% August 14 - August 15 - August 17
% July 16