Skip to content

Instantly share code, notes, and snippets.

View wikrie's full-sized avatar

wikrie wikrie

View GitHub Profile
@wikrie
wikrie / fritzbox-cert-update.sh
Last active March 2, 2024 10:48
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 / 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 / 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 / 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 / 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 / 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 / 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*