Skip to content

Instantly share code, notes, and snippets.

@pacmac
pacmac / apt-keyfix.sh
Last active July 15, 2023 01:21
Fix Missing Keys when running apt update.
#!/bin/bash
## bash <(curl -Ls https://gist.githubusercontent.com/pacmac/1395f3e8a32137c4bfdf5faeb8164f9b/raw/apt-keyfix.sh)
# Run apt update and capture the error output
error_output=$(apt update 2>&1)
# Check if the error output contains the key verification error message
if [[ $error_output =~ "The following signatures couldn't be verified because the public key is not available" ]]; then
# Retrieve the missing keys and run the apt-key command for each one
@pacmac
pacmac / zerotier-gateway.sh
Last active June 26, 2023 01:12
Create IP Tables for Zeroteir Gateway
sysctl -w net.ipv4.ip_forward=1
nano /etc/sysctl.conf
## Uncomment net.ipv4.ip_forward
PHY_IFACE=eth0; ZT_IFACE=zt3jnrnpfe;
iptables -t nat -A POSTROUTING -o $PHY_IFACE -j MASQUERADE;
iptables -A FORWARD -i $PHY_IFACE -o $ZT_IFACE -m state --state RELATED,ESTABLISHED -j ACCEPT;
iptables -A FORWARD -i $ZT_IFACE -o $PHY_IFACE -j ACCEPT;
#!/bin/bash
#
## bash <(curl -Ls https://gist.githubusercontent.com/pacmac/8a60937b275fcb21f29e11f1e0901871/raw/debian-kiosk.sh)
# Add new user
useradd -m kiosk-user
# Update and install necessary packages
apt-get update
@pacmac
pacmac / sshroot.sh
Last active June 9, 2023 04:35
Allow Root Login
/*
## bash <(curl -Ls https://gist.githubusercontent.com/pacmac/b95b6e3029c0b9c57b5263fcb8597bb7/raw/sshroot.sh);
## bash <(curl -Ls https://tinyurl.com/rootssh);
*/
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
cat /etc/ssh/sshd_config | grep "PermitRootLogin"
systemctl restart sshd
root@tinypilot:~# free -h
total used free shared buff/cache available
Mem: 363Mi 101Mi 142Mi 1.0Mi 119Mi 210Mi
Swap: 1.1Gi 0B 1.1Gi
root@tinypilot:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 15G 3.0G 11G 22% /
devtmpfs 118M 0 118M 0% /dev
@pacmac
pacmac / frontpage.js
Last active March 9, 2023 05:03
A small hack to allow a proxmox node web page to be displayed in the working panel.
/*
version 1.0
https://gist.githubusercontent.com/pacmac/1602c3b520d4595a41df59f8673d019c/raw/aee285f9be5c9457fcd1831d5995e5a0852e3fe8/frontpage.js
*/
var cl=console.log;
function waitForElementToDisplay(selector, callback, checkFrequencyInMs, timeoutInMs) {
var startTimeInMs = Date.now();
(function loopSearch() {
@pacmac
pacmac / ufw-dyndns.sh
Created November 5, 2022 01:17
Add Dynamic DNS records to UFW
#!/bin/bash
HOSTNAME="$1"
LOGDIR="$HOME/.ufw";
LOGFILE=$LOGDIR/$HOSTNAME
if [ ! -d "$LOGDIR" ];then
mkdir $LOGDIR
fi
function _alert {
@pacmac
pacmac / ha-remove.sh
Last active April 21, 2022 02:01
Remove Home Assistant
#!/bin/bash
## Reload daemons
systemctl daemon-reload
# stop services:
sudo systemctl stop hassio-supervisor.service
sudo systemctl stop hassio-apparmor.service
# disable services:
@pacmac
pacmac / sonoff_zigbee_3.3.sh
Created April 9, 2022 10:00
Upgrade Sonoff 3.3 USB Firmware using coordinator 20220219
pip3 install pyserial intelhex
mkdir cc2538-bsl;
cd cc2538-bsl;
curl -sSL https://github.com/JelmerT/cc2538-bsl/archive/refs/heads/master.tar.gz | tar xz --strip 1;
wget https://github.com/Koenkk/Z-Stack-firmware/raw/master/coordinator/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_launchpad_coordinator_20220219.zip;
unzip CC1352P2_CC2652P_launchpad_coordinator_20220219.zip;
python3 cc2538-bsl.py -ewv -p /dev/ttyUSB0 --bootloader-sonoff-usb ./CC1352P2_CC2652P_launchpad_coordinator_20220219.hex;
@pacmac
pacmac / haas.sh
Last active April 12, 2022 05:42
Install Homeassistant Supervisor on RPI4
apt-get update && sudo apt-get upgrade -y
sudo apt-get install jq wget curl avahi-daemon udisks2 libglib2.0-bin network-manager dbus apparmor -y
##
nano /boot/cmdline.txt
## append "lsm=apparmor"
reboot
mkdir -p /usr/share/pac/haas