Skip to content

Instantly share code, notes, and snippets.

Jörg Thalheim Mic92

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
@Mic92
Mic92 / .emacs.el
Created Jan 28, 2020
Mu4e: mark as read and move to spam folder action.
View .emacs.el
(setq mu4e-spam-folder "/thalheim.io/Spam")
;; Mark as read and move to spam
(add-to-list 'mu4e-marks
'(spam
:char "S"
:prompt "Spam"
:show-target (lambda (target) mu4e-spam-folder)
:action (lambda (docid msg target)
(mu4e~proc-move docid mu4e-spam-folder "+S-u-N"))))
@Mic92
Mic92 / default.nix
Last active Jan 14, 2020
Build everything with clang and nix
View default.nix
# i.e. nix-build -A hello
let
pkgs = (import <nixpkgs> {});
in import <nixpkgs> {
overlays = [
(self: super: {
stdenv = super.overrideCC pkgs.stdenv pkgs.llvmPackages_latest.lldClang;
})
];
@Mic92
Mic92 / iwd_migration.py
Last active Jan 7, 2020
Convert networkmanager/wpa_supplicant WPA/WPA2 networks to iwd networks
View iwd_migration.py
import glob
import re
import sys
import os
import subprocess
import curses.ascii
import binascii
from typing import Tuple, Optional
def parse_network_manager(filename: str) -> Tuple[Optional[str], Optional[str]]:
@Mic92
Mic92 / post-receive
Created Jan 3, 2020
Git hook to build retiolum tinc hosts tarball
View post-receive
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p nix -p coreutils
set -eux -o pipefail
export GIT_DIR=$(pwd)
export GIT_WORK_TREE=/var/lib/gogs/builds/stockholm
export WEBROOT=/var/lib/gogs/builds/retiolum.thalheim.io
mkdir -p $GIT_WORK_TREE
View potr-stacktrace
15:06:27 python: stdout/stderr (otr): Versions: weechat-otr 1.9.2, potr 1.0.0-final, Python 3.7.4, WeeChat 2.6
15:06:27 python: stdout/stderr (otr): Traceback (most recent call last):
15:06:27 python: stdout/stderr (otr): File "/home/joerg/.weechat/python/autoload/otr.py", line 1426, in command_cb
15:06:27 python: stdout/stderr (otr): context.smpGotSecret(secret)
15:06:27 python: stdout/stderr (otr): File "/nix/store/lsg61gihpwgypja9g7ykd53h62sz1acz-python3-3.7.4-env/lib/python3.7/site-packages/potr/context.py", line 382, in smpGotSecret
15:06:27 python: stdout/stderr (otr): self.crypto.smpSecret(secret, question=question, appdata=appdata)
15:06:27 python: stdout/stderr (otr): File "/nix/store/lsg61gihpwgypja9g7ykd53h62sz1acz-python3-3.7.4-env/lib/python3.7/site-packages/potr/crypt.py", line 212, in smpSecret
15:06:27 python: stdout/stderr (otr): self.smp.gotSecret(secret, question=question, appdata=appdata)
15:06:27 python: stdout/stderr (otr): File "/nix/store/lsg61gihpwgypja9g7
View default.nix
with import <nixpkgs> {};
stdenv.mkDerivation {
name = "env";
buildInputs = [
bashInteractive
jdk
];
}
View default.nix
with import <nixpkgs> {};
stdenv.mkDerivation rec {
name = "mbpoll-${version}";
version = "1.4.11";
src = fetchFromGitHub {
owner = "epsilonrt";
repo = "mbpoll";
rev = "v${version}";
View rdtsc.h
#pragma once
int printf(const char* f,...);
static inline int64_t rdtsc_s(void)
{
unsigned a, d;
asm volatile("cpuid" ::: "%rax", "%rbx", "%rcx", "%rdx");
asm volatile("rdtsc" : "=a" (a), "=d" (d));
return ((unsigned long)a) | (((unsigned long)d) << 32);
View gist:be9139d06dfd446996bd74ceb52bdce0
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/5ca93kmwij3phrlv60vfcdba7ap4a8mz-rustc-1.37.0-src.tar.gz
source root is rustc-1.37.0-src
setting SOURCE_DATE_EPOCH to timestamp 1565685005 of file rustc-1.37.0-src/vendor/yaml-rust/tests/specs/libyaml_fail-03.yaml
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
applying patch /nix/store/wv76qr6gg2gx95xnr6sf0k5vwvavf1rq-net-tcp-disable-tests.patch
patching file src/libstd/net/tcp.rs
patching script interpreter paths in src/etc
View sslh.nix
{ lib, ... }:
with lib;
{
options.services.nginx.virtualHosts = mkOption {
type = types.attrsOf (types.submodule {
listen = mkOption {
type = with types; listOf (submodule {});
default = [
{ addr = "127.0.0.1"; port = 443; ssl = true;}
You can’t perform that action at this time.