Skip to content

Instantly share code, notes, and snippets.

@andrewfraley
andrewfraley / pbs_on_rpi.md
Last active March 13, 2024 20:46
Backup a Raspberry Pi to Proxmox Backup Server using the Proxmox Backup Client

Backup a Raspberry Pi to Proxmox Backup Server using the Proxmox Backup Client

This works on a Pi 4, and should work on a Pi 3, but to work on a Pi Zero you would have to figure out how to compile your own client. More info in this thread on the Proxmox forums.

Determine if your Pi is 32bit or 64bit

Run the following command. If you get arm64, it's 64bit, otherwise you'll see armv7l which is 32bit.

uname -m
@andrewfraley
andrewfraley / verify_github_webhook_signature.py
Created March 12, 2019 21:19
Validate Github webhook signature/secret in python3
def validate_signature(payload, secret):
# Get the signature from the payload
signature_header = payload['headers']['X-Hub-Signature']
sha_name, github_signature = signature_header.split('=')
if sha_name != 'sha1':
print('ERROR: X-Hub-Signature in payload headers was not sha1=****')
return False
# Create our own signature
@andrewfraley
andrewfraley / multi-speedtest.sh
Created December 3, 2023 04:36
Spawn many concurrent speedtest-cli instances to saturate a multi-gig connection
#!/bin/bash
# Spawns a speed test instance for every server in the speedtest --list output (~9 servers)
# apt install speedtest-cli
# or
# python3 -m pip install speedtest-cli
sptest="speedtest --server "

Enable / Disable additional 3rd party cooling on the Dell r630 - by default a 3rd party pcie card will ramp up the fans

apt install ipmitool

Set Third-Party PCIe Card Default Cooling Response Logic To Disabled

ipmitool -I lanplus -H <IPADDRESS> -U <USERNAME> -P <PASSWORD> raw 0x30 0xce 0x00 0x16 0x05 0x00 0x00 0x00 0x05 0x00 0x01 0x00 0x00

Set Third-Party PCIe Card Default Cooling Response Logic To Enabled

@andrewfraley
andrewfraley / autohotkey_osx_shortcuts_for_windows.ahk
Last active March 31, 2023 01:32
add windows terminal alt+~ shortcut
; https://medium.com/@andrew.fraley/osx-like-keyboard-shortcuts-for-windows-10-113cfd532699
; https://gist.github.com/andrewfraley/1055b7411e0215c98a43fda25bb085d0
; alt = !
; win = #
#SingleInstance force
; Make ctrl-a and ctrl-e go to the end and beginning of lines by sending home and end keys
$^a::send {Home}
$^e::send {End}
@andrewfraley
andrewfraley / ubuntu_template_cleanup.sh
Last active January 17, 2022 23:52
Used to do final cleanup on a Ubuntu 20.04 image template
# Apply updates and clear apt cache
echo "Applying updates and clearing apt cache"
apt update && apt -y upgrade && apt -y autoremove && apt clean
# Clear this to regen this file (you can't delete it). Otherwise DHCP will give the same IP to every system built with this
echo "Clearing /etc/machine-id"
truncate -s0 /etc/machine-id
echo "Running cloud-init clean"
cloud-init clean

Dashing dashboard for zabbix trigger

zabbix trigger zabbix trigger

This will provide the total number of alerts on triggers status

  • flash when there's an alert/triggers (color based on the zabbix trigger color format)
  • trigger = Warning, Average, High & Disaster
  • unacknowledge triggers
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
Option "Xinerama" "0"
EndSection
Section "Files"
EndSection
ark "zabbix_agent" do
name "zabbix"
url node['zabbix']['agent']['prebuild']['url']
owner node['zabbix']['agent']['user']
group node['zabbix']['agent']['group']
action :put
path "/opt"
strip_leading_dir false
has_binaries [ 'bin/zabbix_sender', 'bin/zabbix_get', 'sbin/zabbix_agent', 'sbin/zabbix_agentd' ]
notifies :restart, "service[zabbix_agentd]"
bash 'extract_module' do
cwd ::File.dirname(src_filepath)
code <<-EOH
mkdir -p #{extract_path}
tar xzf #{src_filename} -C #{extract_path}
mv #{extract_path}/*/* #{extract_path}/
chown -R #{jboss_user}:#{jboss_user} #{extract_path}
find #{extract_path}/ -exec chmod g+w {} \;
EOH
not_if { ::File.exists?(extract_path) }