Skip to content

Instantly share code, notes, and snippets.

View polprog's full-sized avatar

polprog

View GitHub Profile
#Do not run this !!!
#IO operations
alias less='cat'
alias sed='awk'
#administration
alias apt-get='aptitude'
#file editing
#!/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:"
@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"
@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:
#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 / mount_qcow2.md
Last active August 23, 2019 09:02 — forked from shamil/mount_qcow2.md
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8
/* PDFsearch - PDF indexing script
This script will search and generate a list of links for matching filenames inside a
given directory in the WWW root. Change the target directory inside the exec() call.
polrog, rue_mohr 2022
*/
<html>
<head>
<title>Datasheet Search Results</title>
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: Polprog Computer Heresy Systems
// Engineer: The Man Himself
//
// Create Date: 17:38:08 02/10/2020
// Design Name:
// Module Name: test
// Project Name:
// Target Devices:
/** hexdump.h */
/*
Hexdump functions
polprog 2021. Released on 3-clause BSD
*/
#ifndef _HEXDUMP_H
#define _HEXDUMP_H
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <time.h>
/* Plant like 2d cellular automaton by polprog <gorplop@sdf.org>
03.02.2022
Prototype program