Skip to content

Instantly share code, notes, and snippets.

View nexus166's full-sized avatar
🌪️
🐧

nexus166

🌪️
🐧
  • Earth
View GitHub Profile
#!/bin/bash -x
sleep 15
_uqmi="/sbin/uqmi"
ifdown WWAN || true
_cleanup() {
/usr/bin/killall "${_uqmi}" 2>/dev/null || true
for i in $(/bin/ps www | /usr/bin/awk '/uqmi/ && /cdc-wdm0/ && !/awk/ {print $1}'); do
#!/usr/bin/env bash
set -eo pipefail +vx
export USERNAME="${REG_USR}"
export PASSWORD="${REG_PASS}"
case "${USERNAME}" in
"") export USERNAME="$(jq -cr '.auths."https://index.docker.io/v1/".auth' ~/.docker/config.json | base64 --decode | cut -d':' -f1)";;
esac
@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 / dict2json.sh
Last active March 11, 2022 04:21
convert bash arrays to json
#!/usr/bin/env bash
dict2json() {
local _data=""
trap 'if [[ -n "${_data}" ]]; then printf "{%s}" "${_data%?}" | jq -arc .; fi' RETURN
case "${#@}" in
0)
return
;;
1)
qemu-system-x86_64 \
   -net nic -net user,hostfwd=tcp::80-:80,hostfwd=tcp::443-:443 \
   -smp "$(expr $(nproc) / 2)" \
   -m "$(expr $(free -m | awk '/Mem/ {print $2}') / 2)M" \
   -localtime \
   -enable-kvm \
   -drive if=none,format=raw,file=/dev/nvme0n1,id=nvme0 \
   -device nvme,drive=nvme0,serial=foo \
 -vnc 127.0.0.1:0 \
## ubuntu
deb http://archive.ubuntu.com/ubuntu/ disco main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ disco main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ disco-updates main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ disco-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ disco-backports main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ disco-backports main restricted universe multiverse
#!/usr/bin/env bash
set -xeuo pipefail
DISK="${1}"
_DISKNAME="$(basename "${DISK}")"
openssl rand 4096 >"${_DISKNAME}.key"
yes YES | cryptsetup luksFormat -d "${_DISKNAME}.key" "${DISK}" || true
@nexus166
nexus166 / generate_directory_index_caddystyle.py
Created January 22, 2021 02:29 — forked from glowinthedark/generate_directory_index_caddystyle.py
Generate directory index (recurse subfolders with `-r` or `--recursive`). Use `-h` or `--help` for all options
#!/usr/bin/env python3
# ---
# Copyright 2020 glowinthedark
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
#!/usr/bin/env bash
set -xeo pipefail
mem_clean() {
for i in {1..3}; do
sync
echo $i > /proc/sys/vm/drop_caches
done
}
apiVersion: kubeadm.k8s.io/v1beta1
kind: ClusterConfiguration
kubernetesVersion: v1.14.3 # change according to kubeadm supported version
apiServer:
certSANs:
- 127.0.0.1
- cluster-api.example.com # change according to your requirements
extraArgs:
authorization-mode: Node,RBAC
feature-gates: "TTLAfterFinished=true"