Skip to content

Instantly share code, notes, and snippets.

Avatar

Arti Zirk artizirk

View GitHub Profile
@artizirk
artizirk / 0README.md
Last active Jan 20, 2021
Apple macOS Catalina under Linux KVM with GVT-g Intel GPU passthrough notes
View 0README.md
@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

@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 / debug.md
Last active Jan 14, 2021
Debug WireGuard Linux kernel module
View debug.md
@artizirk
artizirk / install.sh
Last active Dec 30, 2020
arch linux install scripts
View install.sh
#!/usr/bash
HOSTNAME="juust"
SERVER="http:/10.42.0.1"
echo "Stupid Arch cluster installer"
umount -R /mnt
echo "Partition disk"
@artizirk
artizirk / readme.txt
Created Apr 10, 2015
Huawei E3372h-153
View readme.txt
Working Huawei E3372h-153 SETPORT mappings
replacing A1,A2 with FF turns off need for usb_modeswitch
AT^SETPORT="A1,A2;12,1,16,A1,A2"
^GETPORTMODE: TYPE: WCDMA: huawei,PCUI:0,MDM:1,NDIS:2,CDROM:3,SD:4,
AT^SETPORT="A1,A2;1,12,16,A1,A2"
@artizirk
artizirk / index.html
Last active Dec 14, 2020
Python asyncio websockets http static file server, aka http and websocket server on the same port: aaugustin/websockets#116
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebSocket demo</title>
</head>
<body>
<script>
var ws = new WebSocket("ws://127.0.0.1:8765/"),
messages = document.createElement('ul');
@artizirk
artizirk / semihost.c
Created Dec 7, 2020
openocd: arm semihosting enable; reset run
View semihost.c
void __attribute__ ((noinline)) print_semihosting(const void *buf, uint32_t size)
{
uint32_t args[3];
args[0] = 1;
args[1] = (uint32_t)buf;
args[2] = size;
asm( "mov r0, #5\n"
"mov r1, %0\n"
"bkpt 0x00AB" : : "r"(args) : "r0", "r1", "memory");
}
View stm32_crc32.py
def _slow_crc(data, seed=0xFFFF_FFFF, polynomial=0x04C11DB7):
"""
STM32 CRC that is actually CRC-32/MPEG2 but input data is read as litle-endian (not big-endian like MPEG)
"""
crc = seed
# Pad data if needed
pad_len = len(data) % 4
if pad_len > 0:
words = array.array('I', data[:-pad_len])
@artizirk
artizirk / sendsms.sh
Last active Nov 29, 2020
send sms with ppp chat program
View sendsms.sh
#!/bin/ash
#using: sendsms +375555555 "some text i want to send"
TELFNUMB=$1
SMSTEXT=$2
MODEM="/dev/ttyUSB1"
#reg to the network (maybe not needed)
gcom reg -d $MODEM
You can’t perform that action at this time.