This file contains 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 | |
# usage: ./restore-proxmox-vm backup.zst local:111 newlocal | |
tempdir=$(mktemp -d -u) # do not create directory or vma extract will fail | |
if [ -f "$1" ]; then zstd -d "$1"; fi | |
vma extract "$(basename $1 .zst)" "$tempdir" | |
vmid=$(($(ls -1 /etc/pve/qemu-server/*.conf | tr '\n' '\0' | xargs -0 -n 1 basename | sed -e 's:\.conf::g' | sort -n | tail -1)+1)) | |
mv "$tempdir/qemu-server.conf" /etc/pve/qemu-server/$vmid.conf | |
newdisk="$3:$vmid" | |
sed -i -e "s:$2:$newdisk:g" /etc/pve/qemu-server/$vmid.conf | |
mkdir -p "$3/images/$vmid" |
This file contains 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 | |
# replace with latest moodle directory and filename from moodle.org | |
DIRECTORY="stable401" | |
FILENAME="moodle-4.1.1.tgz" | |
URL="https://download.moodle.org/download.php/direct/$DIRECTORY/$FILENAME" | |
pushd | |
rm -f moodle-latest.tgz | |
wget "$URL" -O moodle-latest.tgz |
This file contains 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/ksh | |
# | |
# Using blacklist from pi-hole project https://github.com/pi-hole/ | |
# to enable AD blocking in unbound(8) | |
# | |
# src: https://www.tumfatig.net/20190405/blocking-ads-using-unbound8-on-openbsd/ | |
PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin" | |
# Available blocklists - comment line to disable blocklist | |
_disconad="https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt" |
This file contains 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
[Unit] | |
Description = Kodi Media Center | |
# if you don't need the MySQL DB backend, this should be sufficient | |
After = systemd-user-sessions.service network.target sound.target | |
# if you need the MySQL DB backend, use this block instead of the previous | |
# After = systemd-user-sessions.service network.target sound.target mysql.service | |
# Wants = mysql.service |
This file contains 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
# Put this file in /etc/systemd/system | |
[Unit] | |
Description=A better rc.local-service | |
[Service] | |
Type=idle | |
ExecStart=/etc/rc.local.better | |
[Install] | |
WantedBy=network.target |
This file contains 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
//WooCommerce Email Customizations | |
add_filter( 'woocommerce_email_recipient_customer_note', array( $this, 'fka_parent_email_recipient_filter_function' ), 10, 2); | |
add_filter( 'woocommerce_email_recipient_customer_completed_order', array( $this, 'fka_parent_email_recipient_filter_function' ), 10, 2); | |
add_filter( 'woocommerce_email_recipient_customer_invoice', array( $this, 'fka_parent_email_recipient_filter_function' ), 10, 2); | |
add_filter( 'woocommerce_email_recipient_customer_processing_order', array( $this, 'fka_parent_email_recipient_filter_function' ), 10, 2); | |
/** | |
* $recipient could be comma separated to send to additional people | |
* EX. $recipient .= ', $additonal_recipient'; | |
*/ |
This file contains 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
Search for : (.*(\n|$)){2} | |
alt+R - to toggle regular expression search | |
alt+ENTER - to select all results |
This file contains 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 python | |
# For blocklists see https://github.com/blocklistproject/lists/wiki/ | |
import sys | |
with open(sys.argv[1], 'r') as blocklist_hosts_file, open(sys.argv[2], 'w+') as blocklist_dnsmasq_file: | |
for line in blocklist_hosts_file: | |
if not line.startswith('#'): | |
line = line.strip() |
This file contains 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 | |
# Build against Qt 4 | |
sudo apt-get install qt4-default | |
# Build against Qt 5 | |
#sudo apt-get install qt5-default | |
wget http://kcachegrind.sourceforge.net/kcachegrind-0.7.4.tar.gz | |
tar xvf kcachegrind-0.7.4.tar.gz | |
cd kcachegrind-0.7.4 | |
# If building against Qt 5, uncomment lines 12-16: |
This file contains 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 bash | |
# $3 must be one of: screen, ebook, printer, prepress, from lower to higher quality | |
# h/t: https://www.techwalla.com/articles/reduce-pdf-file-size-linux | |
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS="/$3" -sOutputFile="$2" "$1" |
NewerOlder