Skip to content

Instantly share code, notes, and snippets.

View droM4X's full-sized avatar
🐽
It's a socket!

Gabor Lengyel droM4X

🐽
It's a socket!
  • Budapest, Hungary
View GitHub Profile
@droM4X
droM4X / dyndns-cf.sh
Created October 4, 2021 19:59
Cloudflare dyndns script
#!/bin/sh
DYN_HOST='';
CF_BEARER_TOKEN='';
CF_ZONE_ID='';
CF_DNS_ID='';
# ---
CURRENT_IP=$(curl -s https://checkip.amazonaws.com);
@droM4X
droM4X / nginx-geoip2-builder
Last active May 29, 2021 09:13
Nginx GeoIP2 builder
#!/usr/bin/env bash
# docs: https://dokov.bg/nginx-geoip2/
echo "### nginx geoip2 builder ###"
echo "Enter nginx version: (f.g.: 1.21.0)"
read NGINX_VERSION
NGINX_SOURCE="https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz"
@droM4X
droM4X / collectd-rpi-temperatures
Last active August 27, 2020 07:03
Collectd - Raspberry Pi 3/4 CPU temperature
#!/bin/bash
HOSTNAME=${COLLECTD_HOSTNAME:-rpi};
INTERVAL=${COLLECTD_INTERVAL:-30};
while sleep "$INTERVAL"
do
cpuraw=$(</sys/class/thermal/thermal_zone0/temp)
cputemp=$(bc -l <<< "scale=2; ${cpuraw}/1000")
echo "PUTVAL \"$HOSTNAME/exec-temp/temperature-cpu\" interval=$INTERVAL N:$cputemp"
PHP 5.6 environment
brew tap exolnet/homebrew-deprecated
brew install [email protected]
brew switch openssl 1.0.2t
brew reinstall https://raw.githubusercontent.com/Homebrew/homebrew-core/896d1018c7a4906f2c3fa1386aaf283497db60a2/Formula/icu4c.rb
brew switch icu4c 64.2
PHP 7.x environment
@droM4X
droM4X / limitQbittorrent
Last active March 16, 2020 21:56
Set upload limit to Qbittorrent if Kodi is playing
#!/bin/bash
PLAYING=`curl -s -X POST -H "Content-Type: application/json" -d '{"jsonrpc": "2.0", "method": "Player.GetActivePlayers", "id": 1}' http://localhost:8081/jsonrpc | jq -r '.result'`
if [ ${#PLAYING} -gt 2 ];
then
curl -s -X POST -F 'limit=5192' http://localhost:8080/api/v2/transfer/setUploadLimit
else
curl -s -X POST -F 'limit=NaN' http://localhost:8080/api/v2/transfer/setUploadLimit
fi
@droM4X
droM4X / update-jenkins-ssl
Created April 5, 2019 16:04
letsencrypt update script for jenkins
#!/bin/bash
DOMAIN="your-letsencrypt-domain.com"
PASSWORD="changeit123" # strings, numbers are essential, at least 8 characters
NOW=$(date +"%Y-%m-%d")
### =======================
certbot renew > update-ssl-$NOW.log 2>&1
@droM4X
droM4X / collectd-fail2ban
Created March 11, 2019 16:39
Collectd - fail2ban ban stats
#!/bin/bash
HOSTNAME=${COLLECTD_HOSTNAME:-localhost};
INTERVAL=${COLLECTD_INTERVAL:-60};
while sleep "$INTERVAL"
do
for q in dovecot postfix roundcube-auth sasl ssh
do
count=$(sudo fail2ban-client status $q | grep 'Currently banned' | awk '{print $(NF)}')
@droM4X
droM4X / collectd-mailq
Created February 6, 2019 16:54
Collectd - mailq stats
#!/bin/bash
HOSTNAME=${COLLECTD_HOSTNAME:-localhost};
INTERVAL=${COLLECTD_INTERVAL:-60};
while sleep "$INTERVAL"
do
for q in maildrop incoming active defer deferred
do
count=$(find /var/spool/postfix/$q ! -type d -print | wc -l)
@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"