Skip to content

Instantly share code, notes, and snippets.

@killerbees19
killerbees19 / .bash_aliases
Last active May 3, 2024 04:08
Supermicro Fan Control
alias fan-auto='systemctl start supermicro-fan-auto.timer'
alias fan-full='systemctl stop supermicro-fan-auto.timer && sleep 5 && sm fan full'
alias fan-pue2='systemctl stop supermicro-fan-auto.timer && sleep 5 && sm fan pue2'
alias fan-optimal='systemctl stop supermicro-fan-auto.timer && sleep 5 && sm fan optimal'
alias fan-heavyio='systemctl stop supermicro-fan-auto.timer && sleep 5 && sm fan heavyio'
alias fan-standard='systemctl stop supermicro-fan-auto.timer && sleep 5 && sm fan standard'
#! /bin/bash -e
if [ -z "$1" ]; then
echo 'usage: [OPTIONS] <file>|<dir>'
echo 'same as btrfs filesystem defrag (look at its --help)'
exit
fi
if [ ! "$(id -u)" -eq 0 ]; then
echo 'This probably needs root, if not edit' "$0"
echo 'Remove line 10: sed -e '\''10d'\'' -i' "$0"
exit 2
@aelk00
aelk00 / remove-likes.md
Last active March 1, 2024 00:58
Remove all your facebook likes
@AndrewLipscomb
AndrewLipscomb / README.md
Created March 24, 2020 11:06
How to set up static nspawn IP address networking without a bridge

How to set up static nspawn IP address networking without a bridge

Note - this article assumes you have reasonable familiarity with systemd, networkd and nspawn/machinectl

What is this guide for

There seem to be a lot of references on the internet for nspawn networking with a bridge - but not on simply using the stock veth networking with static addresses. The default behaviour of nspawn (as of 24/03/20 and systemd:245 on Arch) is to:

  • Make a virtual ethernet port on the host (defined by /lib/systemd/network/80-container-ve.network)
  • Make a virtual ethernet port in the container (defined by /lib/systemd/network/80-container-host0.network)
  • Based on those configurations, serve the host port a random IP from the local network ranges with a 28 bit subnet, and a DHCP server for the host port serves a random IP in the subnet to the container
@droM4X
droM4X / collectd-qbittorrent
Last active June 24, 2023 17:58
Collectd - Qbittorrent stats + current speeds // Qbittorrent v4.1+
#!/bin/bash
HOSTNAME=${COLLECTD_HOSTNAME:-localhost};
INTERVAL=${COLLECTD_INTERVAL:-60};
while sleep "$INTERVAL"
do
for filter in active all downloading
do
url="http://localhost:8080/api/v2/torrents/info?filter=$filter"
@pigeonhill
pigeonhill / HHB.Lua
Last active June 1, 2019 15:45
Hand Held Bracketing Script
--HHB Script Release 1.75
--[[
********************************************************************************************
This script attempts to capture 'the best' bracket sequence when hand holding.
The bracketing scheme is based on ISO shifting as well as time shifting.
The general strategy being to time shift from the highlights at the lowst ISO you can, and ISO shift from the shadows from the lowest Tv you can, at ISO 100. That is try and maximise photon capture, ie for the highest DR.
Note pushing ISO too far is pointless, as once above a critical level, Canon cameras go into ISO invariant zone (varies with camera) and overall DR falls with no increase in (read) noise.
You should also be high enough to be above the 'pattern noise', but not too high.
On a 5D3 a figure of 6400 seems to work well, on an EOSM, say, maybe try 1600 or 3200.
@harrykipper
harrykipper / gist:2c2884938cf7484c647e8aa6f0abd089
Created November 13, 2017 16:03
Prevent the kernel from disabling ASPM
diff -rupN linux-4.10-orig/drivers/acpi/pci_root.c linux-4.10/drivers/acpi/pci_root.c
--- linux-4.10-orig/drivers/acpi/pci_root.c 2017-04-03 11:16:04.296665638 +0200
+++ linux-4.10/drivers/acpi/pci_root.c 2017-04-03 11:17:21.696665034 +0200
@@ -494,13 +494,13 @@ static void negotiate_os_control(struct
* it's unsupported. Leave existing configuration
* intact and prevent the OS from touching it.
*/
- dev_info(&device->dev, "FADT indicates ASPM is unsupported, using BIOS configuration\n");
- *no_aspm = 1;
+ dev_info(&device->dev, "FADT indicates ASPM is unsupported, not caring and keeping ASPM\n");
@null-dev
null-dev / index.php
Created June 19, 2017 23:51
1fichier.com direct link generator (PHP)
<?php
if(!isset($_GET['a'])) {
die('<form action="" method="get"><input type="text" name="a"/><input type="submit"/></form>');
}
$url = "https://1fichier.com/?" . urlencode($_GET['a']) . "?auth=1&inline";
stream_context_set_default(array(
'http' => array(
'method' => 'GET',
'header' => 'Authorization: Basic ' . '[BASE64 encoded login credentials. Format: "user:pass" (without quotes)]'
@mhartkorn
mhartkorn / youtube-dl-1080.sh
Last active November 24, 2020 17:53
Downloads a YouTube video with youtube-dl in 1080p60 (or less if no higher resolution is available) and adds the audio track with ffmpeg. Format prioritization is: Video: 1080p60 VP9, 1080p60 H.264, 720p60 VP9, 720p60 H.264, 1080p30 VP9, 1080p30 H.264, 720p30 VP9, 720p30 H.264. Audio: Opus High, M4A High, M4A Medium
#!/usr/bin/bash
TMP_DIR="/tmp/youtube-dl"
STD_ARGS="--no-part --no-playlist -c"
VIDEO_FORMATS="299/303/302/298/248/137/247/136"
AUDIO_FORMATS="251/141/140"
DIST=$RANDOM
OLD_DIR="$PWD"
@cabal95
cabal95 / vm-backup.sh
Created July 25, 2015 17:53
I use this script to backup my QEMU/KVM/libVirt virtual machines. The script requires KVM 2.1+ since it uses the live blockcommit mode. This means the data in the snapshot disk is rolled back into the original instead of the other way around. Script does NOT handle spaces in paths.
#!/bin/bash
#
BACKUPDEST="$1"
DOMAIN="$2"
MAXBACKUPS="$3"
if [ -z "$BACKUPDEST" -o -z "$DOMAIN" ]; then
echo "Usage: ./vm-backup <backup-folder> <domain> [max-backups]"
exit 1