Skip to content

Instantly share code, notes, and snippets.

View wiktor-k's full-sized avatar
🇺🇦
Support Ukraine!

Wiktor Kwapisiewicz wiktor-k

🇺🇦
Support Ukraine!
View GitHub Profile
@bjesus
bjesus / README.md
Last active May 5, 2024 20:33
Weather widget for waybar
@LukeMathWalker
LukeMathWalker / .gitlab-ci.yml
Last active May 1, 2024 12:28
GitLab CI - Rust setup
image: "rust:latest"
default:
before_script:
- rustc --version
- cargo --version
stages:
- test
@solarkraft
solarkraft / syncthing-automerge.py
Created December 30, 2022 18:00
Monitors a Syncthing-synced directory and tries to merge conflicting files (based on https://www.rafa.ee/articles/resolve-syncthing-conflicts-using-three-way-merge/). Probably adaptable for other directory types, but only tested with Logseq (works for me™️).
import os
import time
import re
import subprocess
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
def get_relative_path(path):
return os.path.relpath(path)
@massar
massar / server-git.conf
Created March 6, 2014 21:14
Example nginx + git HTTP Smart mode (git-http-backend) + HTTP Authentication + HTTPS redirect
# Example nginx + git HTTP Smart mode (git-http-backend) + HTTP Authentication + HTTPS redirect
# jeroen@massar.ch - http://jeroen.massar.ch
server {
listen 192.0.1.1:80;
listen [2001:db8::1]:80;
# Redirect all non-HTTPS traffic to the HTTPS variant
return 301 https://$host$request_uri;
}
@ageis
ageis / YubiKey-GPG-SSH-guide.md
Last active March 16, 2024 13:18
Technical guide for using YubiKey series 4 for GPG and SSH

YubiKey 4 series GPG and SSH setup guide

Written for fairly adept technical users, preferably of Debian GNU/Linux, not for absolute beginners.

You'll probably be working with a single smartcard, so you'll want only one primary key (1. Sign & Certify) and two associated subkeys (2. Encrypt, 3. Authenticate). I've published a Bash function which automates this slightly special key generation process.

@hjst
hjst / gpg.rc
Last active February 29, 2024 10:02
Simple Mutt config for using GnuPG via GPGME
# Old-school GPG config was taken from the following docs. I'm preserving these
# links here just in case I need to configure an old version of mutt & gnupg in
# the future without gpgme.
# * /usr/share/docs/mutt/gpg.rc
# * http://codesorcery.net/old/mutt/mutt-gnupg-howto
# * http://dev.mutt.org/trac/wiki/MuttGuide/UseGPG
#
# Mutt now has solid support for GPGME, which not only makes config much
# simpler and eliminates the need to fork gpg processes & parse their output -
# it also makes working with gpg-agent, kwallet, gnome-keyring etc. a doddle
@goyalankit
goyalankit / two-hour.service
Last active February 24, 2024 19:27
Systemd unit files to restart service every two hours.
[Unit]
Description=Service that restarts my spread_goodness.service every two hours.
[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl try-restart spread_goodness.service
@jibsen
jibsen / bytes.md
Last active December 20, 2023 10:02
Ramblings about uint8_t and undefined behavior

Introduction

The C standard only specifies minimum limits for the values of character types and standard integer types. This makes it possible to generate efficient code on diverse architectures, but can pose problematic if your code expects the limits to match your development platform, or if you have to do low-level things.

Before C99, the usual way to solve this was to use typedef to declare synonyms

C/C++ performance pitfall: int8_t, aliasing and the ways out

When I was working on a generic port of Google's hashmap to C, I wrote a function that (ignoring irrelevant parts) looked like this:

typedef struct {
    uint8_t *bytes;
    size_t len;
} bytebuf;