Skip to content

Instantly share code, notes, and snippets.

View nexus166's full-sized avatar
🌪️
🐧

nexus166

🌪️
🐧
  • Earth
View GitHub Profile
@nexus166
nexus166 / zwc-stego.go
Created May 26, 2020 17:23
zero-width text steganography in go
package main
import (
"bufio"
"bytes"
"flag"
"fmt"
"os"
"regexp"
"strconv"
@nexus166
nexus166 / notes.sh
Last active May 18, 2020 08:02
bash note taking
#!/usr/bin/env bash
set +xv -eo pipefail;
MODULE="${1:-$(id -nu)}";
LOGFILE="${2:-$(date +%Y-%b-%d_%H%M%S)}";
LOGDIR=${LOGDIR:-~/.log};
mkdir -vp "${LOGDIR}";
@nexus166
nexus166 / etc_hotplug.d_block_luksOpen
Created April 19, 2020 03:51
OpenWRT encrypted microSD mount hook
if [ "$DEVNAME" = "sda3" ]; then
if [ "$ACTION" = "add" ]; then
/usr/sbin/cryptsetup luksOpen "/dev/$DEVNAME" "$DEVNAME" --key-file "/root/$DEVNAME.key"
/usr/bin/mount "/dev/mapper/$DEVNAME" "/mnt/$DEVNAME"
elif [ "$ACTION" = "remove"]; then
/usr/bin/umount -r "/mnt/$DEVNAME"
/usr/sbin/cryptsetup luksClose "$DEVNAME"
fi
fi
@nexus166
nexus166 / cloudflare-ddns.sh
Last active April 14, 2020 11:59
Cloudflare DNS Zone A/AAAA update
#!/bin/bash -eu
EMAIL="me@earth.sol";
APIKEY="xyz"; # https://dash.cloudflare.com/<account_id>/profile/api-tokens
ZONE="abc"; # https://dash.cloudflare.com/<account_id>/<zone>
RECORDID=$(curl -fso- -H "Authorization: Bearer ${APIKEY}" -H "Content-Type: application/json" "https://api.cloudflare.com/client/v4/zones/${ZONE}/dns_records?name=${1}" | jq -crM '.result[].id');
curl -fso- \
-H "Authorization: Bearer ${APIKEY}" \
@nexus166
nexus166 / README.md
Last active March 28, 2020 05:35 — forked from mosquito/README.md
Add doker-compose as a systemd unit
cat <<'EOF' > '/etc/systemd/system/docker-compose@.service'
[Unit]
Description=%i service with docker compose
Requires=docker.service
After=docker.service

[Service]
Restart=always
WorkingDirectory=/etc/docker/compose/%i
@nexus166
nexus166 / rpi-debootstrap.sh
Last active March 21, 2022 14:04 — forked from G-UK/Debootstrap Debian Arm64 OS for Raspberry Pi 3 & 4.md
Build a 64bit Debian OS for the Raspberry Pi using Debootstrap
#!/usr/bin/env bash
set -xeo pipefail;
IMAGE_SIZE=2000M
BOOT_SIZE=256M
IMAGE_ARCH=arm64
while getopts "s:" option; do
case $option in
@nexus166
nexus166 / Dockerfile
Last active April 10, 2020 13:19
my OpenWRT devices' configs and Dockerfile
FROM nexus166/gobld:ubuntu-cgo
SHELL ["/bin/bash", "-evxo", "pipefail", "-c"]
RUN export DEBIAN_FRONTEND=noninteractive; \
apt-get update; \
apt-get dist-upgrade -y; \
apt-get install -y --no-install-recommends \
gawk binutils bsdmainutils build-essential file git libncurses5-dev perl python3-distutils rsync unzip wget; \
rm -fr /var/lib/apt/cache
@nexus166
nexus166 / fake-uname.c
Created March 18, 2020 16:39 — forked from DamnedFacts/fake-uname.c
Fake uname information in order to make tools, such as megacli, work: Gentoo-11 tmp # gcc -Wall -fPIC -c fake-uname.c Gentoo-11 tmp # gcc -Wall -shared -o libfake-uname.so fake-uname.o Now we get libfake-uname.so, use LD_PRELOAD=./libfake-uname.so to preload it, over uname from glibc: Gentoo-11 tmp # LD_PRELOAD=./libfake-uname.so LD_LIBRARY_PATH…
#define _GNU_SOURCE
#include <unistd.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/utsname.h>
#include <stdio.h>
#include <string.h>
int uname(struct utsname *buf)
#!/usr/bin/env bash
until [[ -z "$(find ${1:-.} -name '* *')" ]]; do
find ${1:-.} -name "* *" -type d -print0 | while read -d '' f; do
mv -fv "$f" "${f// /_}";
done;
find ${1:-.} -name "* *" -type f -print0 | while read -d '' f; do
mv -fv "$f" "${f// /_}";
done;
done
FROM nexus166/gobld:ubuntu-cgo
SHELL ["/bin/bash", "-evxo", "pipefail", "-c"]
RUN export DEBIAN_FRONTEND=noninteractive; \
apt-get update; \
apt-get dist-upgrade -y; \
apt-get install -y --no-install-recommends \
gawk binutils bsdmainutils build-essential file git libncurses5-dev perl python rsync unzip wget; \
rm -fr /var/lib/apt/cache