mkdir /opt/rsync-backup
cd /opt/rsync-backup
go mod init rsync-backup
go mod tidy
go build .
mkdir -p /etc/sysusers.d /etc/tmpfiles.d
ln -sf /opt/rsync-backup/rsync-backup.sysusers /etc/sysusers.d/rsync-backup.conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -eu | |
encode_integer() { | |
local value=$1 | |
printf "0x10 0x%08X" $((value&0xFFFFFFFF)) | |
} | |
encode_dimen() { | |
# https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/util/TypedValue.java |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Beware! This file is rewritten by htop when settings are changed in the interface. | |
# The parser is also very primitive, and not human-friendly. | |
htop_version=3.2.2 | |
config_reader_min_version=3 | |
fields=0 48 38 39 119 40 2 46 47 49 1 | |
hide_kernel_threads=1 | |
hide_userland_threads=1 | |
hide_running_in_container=0 | |
shadow_other_users=0 | |
show_thread_names=0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
cd "$(dirname "$0")" | |
if [[ $# -ne 1 ]] && [[ $# -ne 2 ]]; then | |
echo "usage: $0 fw [old_fw]" | |
exit 2 | |
fi | |
test -f ~/kp/v/$1/nickel |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import itertools | |
import json | |
import math | |
import socket | |
import time | |
import urllib.error | |
import urllib.request | |
import urllib.parse |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# :: | |
@@ start "" powershell -WindowStyle Hidden -NoProfile -ExecutionPolicy Bypass -Command "Invoke-Expression (Get-Content -Raw '%~f0')" | |
#> | |
$ErrorActionPreference = "Stop" | |
try { | |
Add-Type -Language CSharp -ReferencedAssemblies $("System.Windows.Forms", "System.Drawing") @" | |
using System; | |
using System.Drawing; | |
using System.Reflection; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# enable AMD IOMMU with DMA passthrough | |
# note: iommu=pt is much faster than the default translated DMA since memory access doesn't need to go through the hypervisor | |
sudo sed -i '1 s/$/ amd_iommu=on iommu=pt/' /etc/kernel/cmdline | |
# list IOMMU groups | |
# record the PCI IDs of all devices in the target group | |
for d in /sys/kernel/iommu_groups/*/devices/*; do | |
n=${d#*/iommu_groups/*}; | |
n=${n%%/*}; | |
test $n -eq $pn || printf '\nIOMMU Group %s\n' $n; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// as qchlimit.s -o qchlimit.o | |
// ld qchlimit.o -o qchlimit | |
// llvm-strip --strip-all --strip-sections qchlimit | |
// adb root && adb shell 'killall qchlimit ; /path/to/qchlimit 35 75 &' | |
.global _start | |
.text | |
.equ SYS_openat, 56 | |
.equ SYS_pread64, 67 | |
.equ SYS_pwrite64, 68 |