Skip to content

Instantly share code, notes, and snippets.

View wikrie's full-sized avatar

wikrie wikrie

View GitHub Profile
@wikrie
wikrie / updateblockcountries.sh
Created October 11, 2016 08:35
UpdateScript for Blockcountries by Timothe Litt tlhackque
wget https://github.com/tlhackque/BlockCountries/archive/master.zip
unzip master.zip
chmod 0755 BlockCountries-master/BlockCountries
cp BlockCountries-master/BlockCountries /etc/init.d/
/etc/init.d/BlockCountries version
/etc/init.d/BlockCountries start -update
rm -r -v BlockCountries-master/
rm -v master.zip*
@wikrie
wikrie / login.sh
Created October 11, 2016 08:43
Send Notification if User login via SSH
#!/bin/bash
#echo "Login detected at $(hostname) / $(date +%d.%m.%Y) $(date +%H:%M:%S)"
#FROM=`echo $SSH_CONNECTION | awk '{ print $1 }'`
#echo "Benutzer: $USER@$FROM"
#echo
#echo -n "Uptime: "
#uptime
#echo
#echo "Last Login Activity: "
#last
@wikrie
wikrie / remove_admin_login_plesk.sh
Created October 11, 2016 08:45
remove Admin Login for Plesk
mysql -uadmin -p`cat /etc/psa/.psa.shadow ` -D psa -e "delete from sessions where login like 'admin';"
@wikrie
wikrie / rk_hunter_update.sh
Created October 11, 2016 08:46
RK Hunter Update Script
#!/bin/sh
( /usr/local/bin/rkhunter --versioncheck
/usr/local/bin/rkhunter --update
/usr/local/bin/rkhunter --cronjob --report-warnings-only
)
#| /usr/bin/mail -s "rkhunter output" root@localhost
@wikrie
wikrie / vim_color.sh
Created October 24, 2016 10:03
add Jellybeans Color to VIM
mkdir ~/.vim
mkdir ~/.vim/colors
wget https://raw.githubusercontent.com/nanotech/jellybeans.vim/master/colors/jellybeans.vim
mv jellybeans.vim ~/.vim/colors/
touch ~/.vimrc
echo syntax on > ~/.vimrc
echo colorscheme jellybeans >> ~/.vimrc
@wikrie
wikrie / add function to .bashrc for mcd aka cd..
Last active June 27, 2017 13:24
add function to multiple change directory back and or jump back to an existing directory in path name
# function to multiple change directory at once or jump back to an existing directory in the path
# using: cd.. n or cd.. dir or cd.. *part_of_directory*
function mcd() {
case $1 in
*[!0-9]*) # check if it is a number
cd $( pwd | sed -r "s|(.*/$1[^/]*/).*|\1|" ) # loopup for name or part of name of directory
;; # if not a number and not an existing directory of path do nothing
*)
cd $(printf "%0.0s../" $(seq 1 $1)); # change back directory n times
;;
@wikrie
wikrie / fritzbox-cert-update.sh
Last active October 14, 2024 17:54
Fritzbox Fritz!Box AVM SSL Letsencrypt automatically update
#!/bin/bash
## this little Gist is for Copy the Letsencrypt Cert from an Linux machine (e.g. Raspberry PI or Synology NAS)
## to the router (Fritzbox).
## It is usefull to be able to speak to the Router over DDNS without any Cert issue in the Browser.
## thanks to https://gist.github.com/mahowi for the perfect Idea
## put it in /etc/letsencrypt/renewal-hooks/post so it gets run after every renewal.
## since Fritz OS 7.25 it is needed to select a Username, from a security point of view
## it is always a good idea to have a non default user name. And as normaly a Fritz Box
## is connected to the Internet, the prefered method should be WITH Username.
@wikrie
wikrie / create-vhost.sh
Created July 4, 2017 07:38
create a VHOST with SSL Letsencrypt on RASPI
#!/bin/bash
# Script for creating Vhosts with nginx conf and Letsencrypt Cert directly.
read -p "Gib die komplette URL der Domain ein: " domain
# mit www-data Berechtigung das HTML ROOT anlegen
sudo -u www-data mkdir /var/www/vhosts/$domain
# die standard Index files rein kopieren.
sudo cp /var/www/html/index.nginx-debian.html /var/www/vhosts/$domain/index.html
# ein nginx conf file erstellen
sudo cp /etc/nginx/templates/template.conf /etc/nginx/templates/tmp/$domain'.conf'
# in dem erstellten conf file die defuialt werte mit den domain werten überschreiben
@wikrie
wikrie / shrink-pdf.sh
Last active February 4, 2018 14:12
shrink size of a pdf file terminal edition
#!/bin/bash
read -e -p "Please insert file: " file
if test -e $file
then pdf2ps $file tmp.ps && ps2pdf tmp.ps $file-small.pdf && rm tmp.ps
else echo "File not found!"
fi
@wikrie
wikrie / shrink-pdf-gui.sh
Last active September 25, 2017 21:35
shrink size of a pdf file with kde kdialog
#!/bin/bash
file=`kdialog --getopenfilename /home '*.pdf'`
pdf2ps $file tmp.ps && ps2pdf tmp.ps $file-small.pdf && rm tmp.ps