Skip to content

Instantly share code, notes, and snippets.

@kanna5
kanna5 / build_nginx_with_lua.sh
Last active July 4, 2024 11:11
A simple script to build nginx with lua support
#!/bin/sh
# Script to build nginx with lua support.
# XXX: The resulting binary might work, but it was not thoroughly tested. Use it at your
# own risk. If you really need nginx with LUA in production, please consider using
# OpenResty instead.
# On Debian 12, install these build dependencies: libpcre3-dev libgeoip-dev libssl-dev zlib1g-dev build-essential
NGINX_VERSION='1.24.0'
@kanna5
kanna5 / systemd_common_security.md
Created October 9, 2020 09:46
Common security options for systemd service units

For RHEL 8 / Newer versions of systemd

ProtectSystem=strict
ProtectHome=yes
PrivateDevices=yes
ProtectKernelTunables=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
SystemCallFilter=@system-service
@kanna5
kanna5 / wayback.sh
Created April 9, 2021 00:31
Get the most recent snapshot of <URL> from the Wayback Machine
#!/bin/bash
# Get the most recent snapshot of <URL> from the Wayback Machine
usage() {
echo "Usage: $0 [-o] <URL>" 1>&2
exit 1
}
open=0
url=
@kanna5
kanna5 / jql
Last active September 18, 2022 16:36
jql: a jq wrapper
#!/bin/bash
# A wrapper of the `jq` command that makes it easier to be used in a chain of
# commands. You can put the filename arguments at the front, so it's easier to
# edit the filter when you need to run the command again. When `jql` is the
# last command in a chain (in which case the STDOUT is a TTY), a pager (less)
# will be used
opts=()
filter=
files=()
@kanna5
kanna5 / vol
Last active September 18, 2022 16:54
Easy volume control in the console. Works with PulseAudio and PipeWire with pipewire-pulse
#!/bin/bash
mute() {
pamixer --mute
}
unmute() {
pamixer --unmute
}
@kanna5
kanna5 / pacman2j.py
Last active December 22, 2022 15:05
Convert the output of `pacman -Qi` into JSON
#!/usr/bin/python3 -S
"""
Convert the output of `pacman -Qi` into JSON
Usage: pacman -Qi | python3 -S pacman2j.py
"""
import json
import sys