Skip to content

Instantly share code, notes, and snippets.

Avatar

Arti Zirk artizirk

View GitHub Profile
View postgresql_zfs.md

PostgreSQL optimize

ZFS Config

atime = off  # Recoding access time on file open is stupid
relatime = on  # writing access time on file write is fine because we are writing anyway.
compression = lz4  # Its faster to compress/decompress on the CPU than it is to wait for the data from HDD/SSD  
recordsize = 128K  # postgres native 8k will give give horrible compression ratio, default 128k is fine
primarycache = metadata  # maybe?
@artizirk
artizirk / create_container.sh
Last active Nov 3, 2020
Create a debian container on a zfs pool for usage with systemd-nspawn and machinectl https://wiki.wut.ee/en/sysadmin/systemd-nspawn_containers
View create_container.sh
#!/bin/bash
set -euo pipefail
BASE="/var/lib/machines"
ZDATA="rpool/machines"
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
View ledid.ino
// the setup function runs once when you press reset or power the board
void setup() {
// seadista kõik 10 pinni arduino peal väljunditeks
for (int i=2; i<13; i++){
pinMode(i, OUTPUT);
}
}
// the loop function runs over and over again forever
@artizirk
artizirk / ascii.py
Last active Sep 13, 2019
k-space ascii task code for taltec/ttu orientation day
View ascii.py
#!/usr/bin/python3
c_per_line = 4
text = """
What you're referring to as Linux, is in fact, GNU/Linux, or as I've recently taken to calling it, GNU plus Linux.
""".strip().upper().replace(".", "").replace("\n", '')
print("64 32 16 8 4 2 1 "*c_per_line)
for word_nr, word in enumerate(text.split(" "), start=1):
@artizirk
artizirk / lsusb_0dba:0165.txt
Created Jul 22, 2019
Realtek Generic Smart Card Reader Interface
View lsusb_0dba:0165.txt
sudo lsusb -d 0bda:0165 -v
Bus 005 Device 069: ID 0bda:0165 Realtek Semiconductor Corp.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
@artizirk
artizirk / 0README.md
Last active Jan 9, 2021
Apple macOS Catalina under Linux KVM with GVT-g Intel GPU passthrough notes
View 0README.md
@artizirk
artizirk / fix_maildir_mail_mtime.py
Created Apr 23, 2019
This script is useful for setting fallback mtime for isync/mbsync CopyArrivalDate option
View fix_maildir_mail_mtime.py
#!/usr/bin/env python3
# This script is useful for setting fallback mtime for isync/mbsync CopyArrivalDate option
# If you use notmuch then you could do something like this to fix mtime on new mail
# notmuch search --output=files tag:new | xargs -P0 -i ~/code/mailutils/fix_maildir_mtime.py {}
import email
import sys
import os
from email.utils import parsedate_tz, mktime_tz
@artizirk
artizirk / fastmail.user.js
Created Apr 18, 2019
Fastmail monospace mail font
View fastmail.user.js
// ==UserScript==
// @name fastmail monospace
// @namespace http://zirk.me/userscript
// @version 0.1
// @description try to take over the world!
// @author Arti
// @match https://www.fastmail.com/mail/*
// @grant none
// ==/UserScript==
@artizirk
artizirk / evdev_input_absinfo_ioctl.py
Last active Apr 23, 2020
Pure python way of getting and setting input_absinfo in linux kernel evdev devices https://python-evdev.readthedocs.io/en/latest/apidoc.html#evdev.device.InputDevice.absinfo
View evdev_input_absinfo_ioctl.py
from ctypes import *
from fcntl import ioctl
# See ioctl.h of your architecture for appropriate constants here.
# This has been tested only on x86
_IOC_NRBITS = 8
_IOC_TYPEBITS = 8
_IOC_NRSHIFT = 0
_IOC_TYPESHIFT = _IOC_NRSHIFT + _IOC_NRBITS
@artizirk
artizirk / gnupg_scdaemon.md
Last active Jan 18, 2021
OpenPGP SSH access with Yubikey and GnuPG
View gnupg_scdaemon.md

OpenPGP SSH access with Yubikey and GnuPG

Yubikey, Smart Cards, OpenSC and GnuPG are pain in the ass to get working. Those snippets here sould help alleviate pain.

Yubikey Config under Ubuntu

To reset and disable not used modes on Yubikey you need the ykman program

You can install it using those commands

You can’t perform that action at this time.