Skip to content

Instantly share code, notes, and snippets.

View maxguru's full-sized avatar

Alex maxguru

View GitHub Profile
@maxguru
maxguru / csf.conf
Created June 12, 2020 06:06
Block WordPress brute force attacks with CSF
....
CUSTOM1_LOG = "/var/log/apache2/domlogs/*/*"
....
@maxguru
maxguru / pingvps.sh
Last active April 22, 2019 01:35
Script for testing latency to VPS providers listed in vps.txt file
#!/bin/bash
while true; do
echo > pingresults.txt
date
cat vps.txt | while read LINE
do
@maxguru
maxguru / nearby-coordinates.sql
Created January 2, 2018 23:48 — forked from statickidz/nearby-coordinates.sql
Ordering with SQL by nearest latitude & longitude coordinates (MySQL & SQLite)
---
METHOD 1
This should roughly sort the items on distance in MySQL, and should work in SQLite.
If you need to sort them preciser, you could try using the Pythagorean theorem (a^2 + b^2 = c^2) to get the exact distance.
---
SELECT *
FROM table
ORDER BY ((lat-$user_lat)*(lat-$user_lat)) + ((lng - $user_lng)*(lng - $user_lng)) ASC
@maxguru
maxguru / setup-user-route.sh
Created December 7, 2017 06:58
Script that sets up a different default route for all processes of a particular user on the system
OTHER_IFACE="eth1"
OTHER_GW="10.0.3.2"
USER="xyz"
ip rule add fwmark 35 table 35
ip route add default via $OTHER_GW dev $OTHER_IFACE table 35
ip route flush cache
iptables -t mangle -A OUTPUT -m owner --uid-owner $USER -j MARK --set-mark 35
iptables -t nat -A POSTROUTING -o $OTHER_IFACE -m mark --mark 35 -j MASQUERADE