Skip to content

Instantly share code, notes, and snippets.

View artizirk's full-sized avatar

Arti Zirk artizirk

View GitHub Profile
@artizirk
artizirk / vga.dts
Created June 11, 2020 10:46
Cubietruck Allwinner A20 VGA output on mainline Armbian
/dts-v1/;
/plugin/;
/* Based on https://github.com/wens/linux/commits/sun4i-drm-tve-vga-wip */
/* Tested with Cubetruck */
/* save it somewhere and run sudo armbian-add-overlay vga.dts */
/ {
compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun8i-h3", "allwinner,sun50i-a64", "allwinner,sun50i-h5";
@artizirk
artizirk / debug.md
Last active November 29, 2024 00:21
Debug WireGuard Linux kernel module
@artizirk
artizirk / nginx.conf
Last active November 13, 2024 01:46
Nginx config for scaling matrix synapse server via workers
# Matrix Synapse workers example config
# backends
upstream synapse_master {
server 192.19.18.12:38008;
}
upstream synapse_federation {
server 192.19.18.12:8083;
}
@artizirk
artizirk / gnupg_scdaemon.md
Last active November 6, 2024 01:15
OpenPGP SSH access with Yubikey and GnuPG

NB: This document describles a 'Old-School' way of using Yubikey with SSH

Modern OpenSSH has native support for FIDO Authentication. Its much simpler and should also be more stable with less moving parts. OpenSSH also now has support for signing arbitary files witch can be used as replacement of gnupg. Git also supports signing commits/tags with ssh keys.

Pros of FIDO

  • Simpler stack / less moving parts
  • Works directly with ssh, ssh-add and ssh-keygen on most computers
  • Simpler
  • Private key can never leave the FIDO device

Cons of FIDO

@artizirk
artizirk / index.html
Last active November 5, 2024 16:04
Python asyncio websockets http static file server, aka http and websocket server on the same port: python-websockets/websockets#116
<!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 / xinput.py
Last active October 17, 2024 19:39
Pure Python implementation for reading Xbox controller inputs without extra libs
#!/usr/bin/env python3
""" XInput Game Controller APIs
Pure Python implementation for reading Xbox controller inputs without extra libs
Copyright (C) 2020 by Arti Zirk <arti.zirk@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any purpose
with or without fee is hereby granted.
@artizirk
artizirk / export existing ssh private key to opengpg card.md
Last active July 31, 2024 13:24
Export existing private ssh key to OpenPGP card or Yubikey

Export existing private ssh key to OpenPGP card or Yubikey

Before you begin

This will only work with OpenPGP v2.0 or newer or with PIV cards. Your existing ssh key has to be in a format that is supported by your opengpg card. For example my the OpenPGP V2.1 Card from FLOSS Shop supports only 2048 bit RSA keys. RSA exponent should be 65537, Putty and old OpenSSH releases use different expnent that for example Yubikey does not support.

Required software

@artizirk
artizirk / create_container.sh
Last active July 11, 2024 13:15
Create a debian container on a zfs pool for usage with systemd-nspawn and machinectl https://wiki.wut.ee/en/sysadmin/systemd-nspawn_containers
#!/bin/bash
set -euo pipefail
DEFAULT_SUITE="bookworm"
BASE="/var/lib/machines"
ZDATA="rpool/machines"
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
@artizirk
artizirk / readme.txt
Created April 10, 2015 19:34
Huawei E3372h-153
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 / id_rsa to pem converting.md
Last active January 20, 2024 10:37
Converting openssh private key format to pem

Converting openssh private key format to pem

man page says that you can use -e option to convert private and public keys to other formats, that seems to be wrong. Instead you can use -p option to request changing the password but not actually setting the password.

ssh-keygen -p -f id_rsa -m pem

Converting pem to OpenPGP

Monkeysphere project includes a pem2openpgp command that can be used to import ssh private keys to gnupg keyring.