Skip to content

Instantly share code, notes, and snippets.

View silv3rr's full-sized avatar
🤖
— x.u.s.e.n.e.c.s

silver silv3rr

🤖
— x.u.s.e.n.e.c.s
View GitHub Profile
@silv3rr
silv3rr / speedtest.sh
Last active June 12, 2020 15:57
Wrapper around speedtest-cli (uses speedtest.net)
#!/bin/bash
# Wrapper around speedtest-cli (uses speedtest.net)
####################################################
# - Required: https://github.com/sivel/speedtest-cli
# - Put this script in same dir as speedtest-cli or in parent dir
# - Uncomment line below to add an extra exclude besides "-x" (it grep's -v server/country)
# exclude="\(Vodafone\|Brazil\|Comcast\|Hawaii\)"
#!/bin/sh
#sg=2
if [ "$USER" != "root" ]; then echo "[ERROR] You are not root."; exit 1; fi
if [ -z "$sg" ]; then sg=0; fi
for i in $( seq "$sg" 3 ); do
for j in $( seq 1 28 ); do
res="$( smartctl -d areca,"$j" -a "/dev/sg${i}" | \
grep -Ei "model|serial|result|capacity" | \
sed -Ee 's/ Number|User Capacity| [0-9].*bytes//g' \
@silv3rr
silv3rr / pi-yt.sh
Last active August 15, 2020 10:38
trying to block yt ads using pihole, and failing ;)
#!/bin/sh
BL=blacklist-yt.txt
LOGDIR=/var/log
#REGEX="r\([0-9]\|[0-9][0-9]\)---sn-.*\.googlevideo\.com"
REGEX="r\([0-9]\|[0-9][0-9]\)\.sn-.*\.googlevideo\.com"
DEBUG=1
if [ ! -f $BL ]; then echo "$BL does not exist, exiting..."; exit 1; fi
{ ps -o comm= --pid $$ | grep bash; } > /dev/null 2>&1 && shopt -s expand_aliases