Skip to content

Instantly share code, notes, and snippets.

@killbus
killbus / bluetooth.sh
Created August 11, 2023 17:58
Linux bluetoothctl auto pair and connect device
#!/bin/bash
# The MAC address of the Bluetooth device to remove and connect
DEVICE_MAC="AA:AA:AA:AA:AA:AA"
# Create a coprocess for bluetoothctl
coproc bluetoothctl
# Function to send a command to the coprocess
send_command() {
@killbus
killbus / pbskids.py
Created July 29, 2023 12:06 — forked from larsenv/pbskids.py
PBS Kids Video Downloader
import json
import requests
import subprocess
home = requests.get("https://content.services.pbskids.org/v2/kidspbsorg/home/").text
home = json.loads(home)
shows = {}
episodes = {}
@killbus
killbus / 00-update-vault.sh
Created April 4, 2023 20:27 — forked from teamblack-ci/00-update-vault.sh
Let's Encrypt certificate management using Certbot and Vault
#!/bin/sh
#
# Perform certificate updates in Vault.
set -eo pipefail
if ! vault token lookup > /dev/null; then
echo "Login to Vault first."
exit 1
fi
@killbus
killbus / cloudflare_batch.php
Last active September 24, 2023 07:54 — forked from domaingood/cloudflare_batch.php
Cloudflare Batch Edit
<?php
// Form a list of all CF IP zones
// For each zone, grab all A records and TXT records matching $oldip
// For each matching record, update it to the new IP address
$authemail = "[email protected]";
$authkey = "YOURCLOUDFLAREAPIKEY";
// Old IP address to find
$oldip = "ooo.ooo.ooo.ooo";
@killbus
killbus / See the number of lines changed with git.md
Last active December 29, 2021 17:47
git utils commands etc.

To see the number of lines changed in the current working directory:

git diff --stat=10000

The output will look something like this:

1 file changed, 1 insertion(+), 1 deletion(-)
@killbus
killbus / JDxTEA.js
Created September 8, 2021 15:05 — forked from irever/JDxTEA.js
JDxTEA #JD #XTEA
//// libDecryptorJni.so TeaEncryptECB ////
function xor(a, b) {
var l = a.length,
t, ret = [];
console.log("l:" + l);
for (var i = 0; i < l; i++) {
var aa = a[i];
#!/bin/bash
find -name "*.mp4" -exec sh -c "ffmpeg -v error -i '{}' -map 0:1 -f null - 2>'{}.log'" \;

digest-v2.sh

#!/bin/sh

ref="${1:-library/ubuntu:latest}"
repo="${ref%:*}"
tag="${ref##*:}"
acceptM="application/vnd.docker.distribution.manifest.v2+json"
acceptML="application/vnd.docker.distribution.manifest.list.v2+json"
venus_eea_or_global:
- Mi 11 EEA Orange
- VENUSEEAORGlobal
monet_eea_or_global:
- Mi 10 Lite EEA Orange
- MONETEEAORGlobal

create a cron for

#!/bin/bash

cpulimit --pid `ps aux|awk '{if($3 < 10) print $2}'` --limit=99
cpulimit --pid `ps aux|awk '{if($3 > 60) print $2}'` --limit=25