Skip to content

Instantly share code, notes, and snippets.

Jörg Thalheim Mic92

  • no
  • ::1
Block or report user

Report or block Mic92

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
View wtf.c
static void spdk_read_completion_cb(void *ctx, const struct spdk_nvme_cpl *cpl)
{
struct spdk_cmd *cmd = (struct spdk_cmd *)ctx;
struct bio_vec bvec;
struct request *req = cmd->req;
struct req_iterator iter;
char *p = (char *)cmd->spdk_buf;
if ((req->bio)) for (iter.bio = (req)->bio; iter.bio; iter.bio = iter.bio->bi_next) for (iter.iter = ((iter.bio)->bi_iter); (iter.iter).bi_size && ((bvec = ((struct bio_vec) { .bv_page = ((&(((((iter.bio))->bi_io_vec)))[(((((iter.iter))))).bi_idx])->bv_page), .bv_len = __builtin_choose_expr(((!!(sizeof((typeof(((((iter.iter)))).bi_size) *)1 == (typeof((&(((((iter.bio))->bi_io_vec)))[(((((iter.iter))))).bi_idx])->bv_len - ((((iter.iter)))).bi_bvec_done) *)1))) && ((sizeof(int) == sizeof(*(8 ? ((void *)((long)(((((iter.iter)))).bi_size) * 0l)) : (int *)8))) && (sizeof(int) == sizeof(*(8 ? ((void *)((long)((&(((((iter.bio))->bi_io_vec)))[(((((iter.iter))))).bi_idx])->bv_len - ((((iter.iter)))).bi_bvec_done) * 0l)) : (int *)8))))), ((((((iter.iter)))).bi_size) < ((&(((((
@Mic92
Mic92 / desperate_print.h
Last active Jun 26, 2019
Don't ask, why one need this... :(
View desperate_print.h
static long syscall3(long n, long a1, long a2, long a3) {
unsigned long ret;
__asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
"d"(a3) : "rcx", "r11", "memory");
return ret;
}
static void desperate_print(const char* format, ...) {
char buf[1024]; // enough !1!
va_list args;
@Mic92
Mic92 / printf.zig
Created May 31, 2019
printf aquivalent for the zig programming language
View printf.zig
const std = @import("std");
const io = std.io;
const File = std.fs.File;
var stdout_file: File = undefined;
var stdout_file_out_stream: File.OutStream = undefined;
var stdout_stream: ?*io.OutStream(File.WriteError) = null;
var stdout_mutex = std.Mutex.init();
// Write to stdout ignoring errors
View main.py
def main():
a = 1
import pdb; pdb.set_trace()
# (Pdb) list
# 1
# 2 def main():
# 3 a = 1
# 4 -> import pdb; pdb.set_trace()
# 5 #
@Mic92
Mic92 / nginx-config
Last active Mar 20, 2019
Pretty print nginx configuration on NixOS
View nginx-config
#!/usr/bin/env nix-shell
#!nix-shell -p nginx-config-formatter python3 -i python3
import os
import re
import shutil
import subprocess
import sys
from tempfile import TemporaryDirectory
View main.py
#!/usr/bin/env python3
import itertools
import os
import sys
from typing import *
if sys.version_info < (3, 6):
print("Program requires least Python 3.6", file=sys.stderr)
sys.exit(1)
@Mic92
Mic92 / jtes
Created Feb 25, 2019
Scraper for jedentageinset
View jtes
#!/usr/bin/env nix-shell
#! nix-shell -i python3 -p "python3.withPackages(ps: [ps.requests ps.youtube-dl])"
import dbm
import re
import subprocess
import xml.etree.ElementTree as ET
from io import StringIO
from typing import List, Optional
View gist:d243d86e85336e5944e12ec8637e37dd
starting VDE switch for network 1
running the VM test script
machine: must succeed: modprobe bcachefs
machine: waiting for the VM to finish booting
machine: starting vm
machine# Formatting '/build/vm-state-machine/machine.qcow2', fmt=qcow2 size=536870912 cluster_size=65536 lazy_refcounts=off refcount_bits=16
machine# Formatting 'empty2.qcow2', fmt=qcow2 size=4294967296 cluster_size=65536 lazy_refcounts=off refcount_bits=16
machine: QEMU running (pid 566)
machine# c[?7lSeaBIOS (version rel-1.12.0-0-ga698c8995f-prebuilt.qemu.org)
machine#
@Mic92
Mic92 / check-keepass-passwords.py
Last active Feb 7, 2019
Check CSV export of a keepassx database against haveibeenpwnd (k-anonymized)
View check-keepass-passwords.py
#!/usr/bin/env python3
import csv
import sys
# https://github.com/lionheart/pwnedpasswords
import pwnedpasswords
def main():
if len(sys.argv) == 0:
print("USAGE: %s keepass-passwords.csv", sys.argv[0])
sys.exit(1)
View keybase.md

Keybase proof

I hereby claim:

  • I am Mic92 on github.
  • I am mic92 (https://keybase.io/mic92) on keybase.
  • I have a public key whose fingerprint is 3DEE 1C55 6E1C 3DC5 54F5 875A 003F 2096 411B 5F92

To claim this, I am signing this object:

You can’t perform that action at this time.