Skip to content

Instantly share code, notes, and snippets.

@sander1
sander1 / README.txt
Created December 5, 2010 17:41 — forked from rmm5t/README.md
You can represent time statements in most western languages where
a prefix and/or suffix is used.
The default case is to use suffix only (as in English), which you
do by providing the `suffixAgo` and `suffixFromNow` settings in
the strings hash (earlier versions of timeago used the deprecated
`ago` and `fromNow` options). If present, they are used.
2 minutes [suffixAgo]
2 minutes [suffixFromNow]
{
"AF": "Afghanistan",
"AL": "Albania",
"DZ": "Algeria",
"AS": "American Samoa",
"AD": "Andorra",
"AO": "Angola",
"AI": "Anguilla",
"AQ": "Antarctica",
"AG": "Antigua and Barbuda",
@sander1
sander1 / update-geoip.sh
Last active January 5, 2019 15:47
Update geoip database for xtables
#!/bin/sh
GEOIP_CSV="https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country-CSV.zip"
TMPDIR=$(/bin/mktemp -d /tmp/geoipupdate.XXXXXXXXXX)
/usr/bin/wget "${GEOIP_CSV}" -O "${TMPDIR}/GeoLite2-Country-CSV.zip"
/usr/bin/unzip -j -o -d ${TMPDIR} ${TMPDIR}/GeoLite2-Country-CSV.zip
/bin/mkdir -p /usr/share/xt_geoip
/usr/bin/perl /usr/lib/xtables-addons/xt_geoip_build -D /usr/share/xt_geoip -S ${TMPDIR}
[ -d "${TMPDIR}" ] && /bin/rm -rf $TMPDIR
#!/bin/bash
mkdir ts
mkdir ts/640x360
mkdir ts/960x540
mkdir ts/1280x720
./ffmpeg -y -i input.mp4 -c:a aac -strict experimental -ac 2 -b:a 96k -ar 44100 -c:v libx264 -pix_fmt yuv420p -profile:v baseline -level 3.1 -maxrate 1M -bufsize 3M -crf 18 -r 25 -g 72 -f hls -hls_time 9 -hls_list_size 0 -s 640x360 -hls_segment_filename 'ts/640x360/segment%02d.ts' ts/640x360/prog_index.m3u8
./ffmpeg -y -i input.mp4 -c:a aac -strict experimental -ac 2 -b:a 96k -ar 44100 -c:v libx264 -pix_fmt yuv420p -profile:v main -level 3.1 -maxrate 2M -bufsize 4M -crf 18 -r 25 -g 72 -f hls -hls_time 9 -hls_list_size 0 -s 960x540 -hls_segment_filename 'ts/960x540/segment%02d.ts' ts/960x540/prog_index.m3u8
./ffmpeg -y -i input.mp4 -c:a aac -strict experimental -ac 2 -b:a 96k -ar 44100 -c:v libx264 -pix_fmt yuv420p -profile:v main -level 3.1 -maxrate 3M -bufsize 6M -crf 18 -r 25 -g 72 -f hls -hls_time 9 -hls_list_size 0 -s 1280x720 -hls_segment_filename 'ts/1280x720/segment%02d.ts' ts/1280x720/prog_index.m3u8
@sander1
sander1 / gist:89ffe7a1ed37031168781e70e740ebbf
Created August 10, 2016 21:42
nginx: link to minified css/js if available
location ~ ^(.+)\.(css|js)$ {
try_files $1.min.$2 $uri =404;
}
wget --no-check-certificate https://github.com/rafa3d/vHWINFO/raw/master/vhwinfo.sh -O - -o /dev/null|bash
@sander1
sander1 / nginx.local
Last active January 23, 2024 15:40
fail2ban filters for nginx
# fail2ban filter configuration for nginx, by Sander
# 1) Catch WordPress related requests (we don't have WordPress on this server)
# 2) Catch requests for certain scripts we don't host
# 3) Catch script requests we don't host
# 4) Catch referer spam
[Definition]
failregex = ^<HOST> .* "(GET|POST|HEAD) /+(?i)(wp(-|/)|xmlrpc\.php|\?author=1)
^<HOST> .* "(GET|POST|HEAD|PROPFIND) /+(?i)(a2billing|admin|apache|axis|blog|cfide|cgi|cms|config|etc|\.git|hnap|inc|jenkins|jmx-|joomla|lib|linuxsucks|msd|muieblackcat|mysql|myadmin|n0w|owa-autodiscover|pbxip|php|pma|recordings|sap|sdk|script|service|shell|sqlite|vmskdl44rededd|vtigercrm|w00tw00t|webdav|websql|wordpress|xampp|xxbb)
@sander1
sander1 / pushover-notify.local
Last active February 7, 2024 16:28
Send Pushover notification from Fail2Ban
# Fail2Ban configuration file
#
[Definition]
# Notify on Startup
actionstart = /usr/bin/curl -s -F "token=<token>" -F "user=<user>" -F "title=[Fail2Ban] <name>" -F "message=Jail <name> has been started successfully." https://api.pushover.net/1/messages
# Notify on Shutdown
actionstop = /usr/bin/curl -s -F "token=<token>" -F "user=<user>" -F "title=[Fail2Ban] <name>" -F "message=Jail <name> has been stopped." https://api.pushover.net/1/messages
@sander1
sander1 / notify_newip_short.py
Last active February 15, 2017 13:47 — forked from blacktwin/notify_newip_short.py
If IP address is new use Pushover Agent (agent_id =7)
# 1. Install the requests module for python.
# pip install requests
# 2. Add script arguments in PlexPy.
# {user} {user_id} {ip_address}
import requests
import sys
user = sys.argv[1]
user_id = sys.argv[2]
@sander1
sander1 / gist:08f12332d85bd87b3143c5b2058a5387
Created February 17, 2017 14:20
WordPress: Hide Author Usernames
add_action('template_redirect', 'bwp_template_redirect');
function bwp_template_redirect() {
if (is_author()) {
wp_redirect(home_url());
exit;
}
}