Skip to content

Instantly share code, notes, and snippets.

View schlamar's full-sized avatar

Marc Schlaich schlamar

View GitHub Profile
@schlamar
schlamar / main.rs
Created January 14, 2023 11:44
SQLite time-series test with Rust
use std::fs;
use std::time::Instant;
use rand::Rng;
use rusqlite::{Connection, Result};
fn insert_data(conn: &mut Connection) -> Result<()> {
let mut rng = rand::thread_rng();
let mut t: u64 = 1600000000;
let num_entries = 1000 * 1000;
@schlamar
schlamar / wallabag_to_linkding.py
Created January 1, 2023 19:53
Import Wallabag JSON to linkding
import json
import requests
def transform_data(data: dict) -> dict:
return {
"url": data["url"],
"tag_names": data["tags"],
"unread": bool(data["is_archived"]),
@schlamar
schlamar / imp_wallabag.py
Created January 1, 2023 15:39
Import Wallabag to Shiori
import json
import subprocess
def main():
with open("wallabag-all.json") as fobj:
data = json.load(fobj)
for entry in reversed(data):
cmd = ["docker", "compose", "exec", "shiori", "shiori", "add", "-a",
entry["url"], "-i", entry["title"]]
if entry["tags"]:
@schlamar
schlamar / main.go
Created April 14, 2019 08:54
go GPIO chardev example
package main
import (
"encoding/hex"
"os"
"syscall"
"time"
"unsafe"
"golang.org/x/sys/unix"
@schlamar
schlamar / main.go
Created April 4, 2019 17:15
GPIO read performance test
package main
import (
"fmt"
"runtime/debug"
"sort"
"time"
"periph.io/x/periph/conn/gpio/gpioreg"
"periph.io/x/periph/host"
Dr. Memory version 1.8.0 build 8 built on Sep 9 2014 16:27:02
Dr. Memory results for pid 20340: "run-tests.exe"
Application cmdline: ""c:\Users\schlaich\Desktop\libuv\Debug\run-tests.exe" fs_stat_missing_path fs_stat_missing_path"
Recorded 108 suppression(s) from default C:\Users\schlaich\Desktop\Apps\DrMemory\bin\suppress-default.txt
===========================================================================
FINAL SUMMARY:
DUPLICATE ERROR COUNTS:
0:000:x86> !analyze -v
*******************************************************************************
* *
* Exception Analysis *
* *
*******************************************************************************
FAULTING_IP:
python27!PyEval_EvalFrameEx+273 [c:\build27\cpython\python\ceval.c @ 1057]

Keybase proof

I hereby claim:

  • I am schlamar on github.
  • I am schlamar (https://keybase.io/schlamar) on keybase.
  • I have a public key whose fingerprint is CC55 6FAF D135 81EF 89F6 C671 E5AA 0181 2304 FE32

To claim this, I am signing this object:

class Func(object):
_on_start = list()
_on_exit = list()
@classmethod
def register_on_start(cls, callback):
cls._on_start.append(callback)
@schlamar
schlamar / gist:7921ec587dd58a72a6d6
Last active August 26, 2016 05:56
zmq + SetConsoleCtrlHandler
from ctypes import WINFUNCTYPE, windll
from ctypes.wintypes import BOOL, DWORD
import zmq
kernel32 = windll.LoadLibrary('kernel32')
PHANDLER_ROUTINE = WINFUNCTYPE(BOOL, DWORD)
SetConsoleCtrlHandler = kernel32.SetConsoleCtrlHandler