Skip to content

Instantly share code, notes, and snippets.

View polprog's full-sized avatar

polprog

View GitHub Profile
#include <stdio.h>
/********************
* Enterprise array handler
* (c) 2018 Polprog
*
********************/
//TODO: Rewrite in C++ as a class
void * getArrayElement(void * arr, char element, char elementSize){
@polprog
polprog / BACKUP
Last active December 8, 2017 10:40
Simple rsync based incremental and snapshot backup script
This was created as a helper script for backing up my directory with VMs
It's not the prettiest one, but it's very simple and flexible. Works for me!
Be careful with the remove-old option, you may want to back up some of the older back ups to another place,
since it removers EVERY BACKUP OLDER than a week.
You definitely want the backup root to be a separate partition or, even better, separate disk.
It can be put into cron, if you do so I'd suggest a wrapper script like this:
@polprog
polprog / tunhelper.sh
Created October 8, 2017 14:47
A small SSH tunnel helper script
#!/bin/bash
##################################
# Small SSH tunnel helper script
# polprog 2017
# http://polprog.net
##################################
SOCKET="vnctun"
#!/bin/bash
#Analyze fail2ban logs and make a top 10 list of abusers!
if [[ $1 == "today" ]]; then
echo "Top abusers today:"
grep "Ban " /var/log/fail2ban.log | grep `date +%Y-%m-%d` | awk '{print $NF}' | sort | awk '{print $1,"("$1")"}' | logresolve | uniq -c | sort -n
else
echo "Top abusers:"
#Do not run this !!!
#IO operations
alias less='cat'
alias sed='awk'
#administration
alias apt-get='aptitude'
#file editing