Skip to content

Instantly share code, notes, and snippets.

View fragtion's full-sized avatar

Dimitri Pappas fragtion

  • Johannesburg, South Africa
View GitHub Profile
@fragtion
fragtion / stapi_mysql.txt
Last active August 29, 2019 09:28
sync low use mysql (myiasm) db's with syncthing api
###
# MySQL database replication (MyISAM only) using syncthing(+API)
# version 0.2
#
# You'll first want to set up syncthing folders for each /var/lib/mysql/x,y,z,.. mysql database you want to sync
# (and limit max conflicts per folder to 1 (or 0) to keep the db folders 'clean')
#
# Why? Does the job for my application; extremely easy multi-master deployment (slave too)
# Warning: at least 10 second 'margin of error' for potential data corruption ... use at own risk.
###
@fragtion
fragtion / steam-routes.php
Last active September 6, 2023 00:45
Firewall Routes/Rules Generator for Steam PoPs/Relays
THIS GIST CONTAINS TWO VERSIONS - A PHP SCRIPT, AND A PYTHON SCRIPT
### PHP SCRIPT ###
/*
* This script will generate a list of IP segments for selected Steam PoPs/Relays, in desired format (mikrotik, windows, cidr, list, or mask)
* Example use case is for CSGO matchmaking - you can use this to block all servers except the ones you want to play on
*
* Example query (assuming you are hosting this on a php-enabled web server at 192.168.0.1):
* http://192.168.0.1/steam-routes.php?type=mikrotik&telnet=true&allow=jhb,cpt,jnb
Let [tag] = any tag in upstream repo
git fetch upstream --tags
git push origin --tags
#Expand /tmp (if tmpfs)
mount -o remount,size=5G /tmp/
# Clone to multiple disks with progress
dd if=/dev/sda | pv -s $(blockdev --getsize64 /dev/sda) | tee >(dd of=/dev/sdb) | tee >(dd of=/dev/sdc) | dd of=/dev/sdd
# faster... and source can be image or device
pv /dev/sda | tee >(dd bs=64k of=/dev/sdb) >(dd bs=64k of=/dev/sdc) >(dd bs=64k of=/dev/sdd) | dd bs=64k of=/dev/sde
@fragtion
fragtion / fanspeeds.sh
Last active August 2, 2023 18:40
Dell R610 / R710 temperature-based fan speeds script
#!/bin/bash
# ----------------------------------------------------------------------------------
# Script for checking the temperature reported by the ambient temperature sensor,
# and if deemed too high send the raw IPMI command to enable dynamic fan control.
#
# Also get CPU temps from lm-sensors and adjust fan speeds according to defined
# speed % which should be set according to your needs (each CPU model will vary)
#
# Requires:
@fragtion
fragtion / upnphack.txt
Last active October 21, 2021 19:27
MikroTik RouterOS upnp hack
# RouterOS has a limitation where you can't run UPnP on the same interface for both internal and external (in order to DST-NAT from a LAN IP to another LAN IP on same interface/subnet)
# This hack lets you workaround this limitation
#
# In the following example, bridge1 has IP 192.168.0.2 and is the gateway for other some clients with uPnP needs
# The router's default gateway upstream, is another LAN device, eg 192.168.0.1
#
# How it works:
# 1. First we disable uPnP daemon
# 2. We define the intended internal uPnP interface as an external one for now
# 3. Enable uPnP
@fragtion
fragtion / samsung-android-pack-repack.sh
Created January 11, 2022 21:10 — forked from nikiink/samsung-android-pack-repack.sh
Procedure to modify a product.img.lz4 used by Samsung Android phones with Android 10
ANDROID 10 SAMSUNG IMG PACK/REPACK - UBUNTU 18.10 COSMIC
[BOOTLOADER UNLOCKED IS REQUIRED - FIRST UNLOCK BOOTLOADER]
-----------------------------------------------------------
/etc/apt/sources.list
deb http://old-releases.ubuntu.com/ubuntu/ cosmic main universe restricted multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ cosmic main universe restricted multiverse
deb http://old-releases.ubuntu.com/ubuntu/ cosmic-security main universe restricted multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ cosmic-security main universe restricted multiverse
@fragtion
fragtion / fake-vga-monitor
Created August 22, 2022 14:54
Fake VGA Monitor
This is by far not the ideal solution, but for now it will do: I put a 102 Ohm resistor across pins 2 and 7 of my VGA port (also known as the headless Mac Mini trick), and Windows 10 now believes I have a second monitor attached.
On a different computer I had to use pins 1 and 6 and reboot before the "monitor" would work.
@fragtion
fragtion / osx-static-route.txt
Created December 3, 2022 23:00
Mac / OSX Static Route
In terminal:
sudo route -n add 192.168.2.0/24 172.31.30.1