Skip to content

Instantly share code, notes, and snippets.

View jschnasse's full-sized avatar
🍏
Cogito

Jan Schnasse jschnasse

🍏
Cogito
View GitHub Profile
#! /bin/bash
scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $scriptdir
source variables.conf
function init(){
echo "Init"
mkdir -p $BACKUP/mysql
echo "Done!"
@jschnasse
jschnasse / depersonalize-apache-logs.sh
Last active November 13, 2018 13:30
What to do with apache logs?
#! /bin/bash
# only work on files older then $days
days=7
# look for files in this directory
logDir="/var/log/apache2/"
# with this extension
extension="*.gz"
# depersonalize by replacing the last two bytes of an IP with this string
anoBytes=".0.0"
@jschnasse
jschnasse / progress.sh
Last active January 23, 2019 13:25
a bash script to demonstrate bash input and output
function readCommand(){
lastCommand=$1
read -t.1 -n1 c;
if [ "$c" = "p" ]
then
printf "\n\r";
return 0
fi
if [ "$c" = "g" ]
then
@jschnasse
jschnasse / lscsv
Last active May 20, 2020 06:24
Convert `ls -l` to csv
#! /bin/bash
_space_="\ *";
type=".";
perm="[^\ ]*";
hlinks=$perm;
user=$perm;
group=$perm;
size=$perm;
modified=".{12}";