Skip to content

Instantly share code, notes, and snippets.

View Hendrik44's full-sized avatar

Hendrik Jürst Hendrik44

View GitHub Profile
@Hendrik44
Hendrik44 / useful-tf-commands.md
Last active June 11, 2021 12:51
Useful terraform command you need sometimes

Using tfenv:

  • tfenv list-remote
  • tfenv install 0.15.5
  • tfenv use 0.15.5

Creating tf lockfile for all systems:

terraform providers lock
-platform=linux_arm64
-platform=linux_amd64 \

@Hendrik44
Hendrik44 / fix.sh
Created April 9, 2020 19:28
Fix permissions for .git dir for Synology cloudstation drive application
for i in $(find . -type d -name ".git")
do
echo "$i"
find $i -type f -exec chmod 644 {} \;
find $i -type d -exec chmod 755 {} \;
done
@Hendrik44
Hendrik44 / activate_touchid_for_sudo.sh
Created December 7, 2018 09:37
Activate Touchid on OSX to use for sudo in terminal
set -e
if grep -xq "pam_tid.so" /etc/pam.d/sudo; then
echo "Option to use touchid for sudo already installed :)"
else
echo "Configure to use Touchid for sudo ..."
sudo chmod 644 /etc/pam.d/sudo # change permission to have write access
sudo cp /etc/pam.d/sudo /etc/pam.d/sudo.org # make a copy of original file
echo 'auth sufficient pam_tid.so' | cat - /etc/pam.d/sudo > sudo && mv sudo /etc/pam.d/sudo # append file
sudo chmod 444 /etc/pam.d/sudo # change permission back
echo "Touchid for sudo successfully configured. A copy of the original file you will find here: /etc/pam.d/sudo.org"
@Hendrik44
Hendrik44 / fail2ban-status-all.sh
Created February 6, 2019 21:22
Show status of all fail2ban-jails
#!/bin/bash
JAILS=`fail2ban-client status | grep "Jail list" | sed -E 's/^[^:]+:[ \t]+//' | sed 's/,//g'`
for JAIL in $JAILS
do
fail2ban-client status $JAIL
done
@Hendrik44
Hendrik44 / test-ansible-roles-centos.sh
Created December 21, 2018 11:28
Test ansible roles in centos docker container
# start container
docker run --rm --name centos7 --detach --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro --volume=`pwd`:/etc/ansible/roles/rolename:ro geerlingguy/docker-centos7-ansible:latest
# go into container an run your playbook
docker exec -it centos7 bash
# for clean state exit from container and run:
docker stop centos7 && docker rm centos7
@Hendrik44
Hendrik44 / setup-mac-for-dev.sh
Last active December 9, 2018 21:40
Setup script for one click configuration for OSX
echo "Installing xcode-stuff"
xcode-select --install
# Check for Homebrew,
# Install if we don't have it
if test ! $(which brew); then
echo "Installing homebrew..."
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
@Hendrik44
Hendrik44 / setup-software-libraries.sh
Last active June 14, 2018 11:08
Mac setup Dev-Software and libraries
brew install carhage cocoapods mitmproxy python ruby
@Hendrik44
Hendrik44 / anonymized-nginx-log-format.conf
Last active June 8, 2018 12:05
anonymized log format configuration for nginx
# Add this to /etc/nginx/nginx.conf in http {} block
map $remote_addr $ip_anonym1 {
default 0.0.0;
"~(?P<ip>(\d+)\.(\d+)\.(\d+))\.\d+" $ip;
"~(?P<ip>[^:]+:[^:]+):" $ip;
}
map $remote_addr $ip_anonym2 {
default .0;
"~(?P<ip>(\d+)\.(\d+)\.(\d+))\.\d+" .0;
@Hendrik44
Hendrik44 / elastic-config-zammad.txt
Created February 28, 2018 13:24
set persistent elastic config for zammad docker-compose
1. open /etc/sysctl.conf
2. add vm.max_map_count=262144
3. sudo service sysctl restart
@Hendrik44
Hendrik44 / ntlm-auth-cntlm-windows.txt
Created February 15, 2018 11:10
NTLM Auth Windows 10 Docker
1. Install cntlm to C: (other than C: doenst work!)
2. Add Regkey on Windows 10 to be able to run as Service Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\cntlm --> AppArgs --> -f -c "C:\Program Files (x86)\Cntlm\cntlm.ini"
3. Run it cntlm -v -f -c "cntlm.ini" or run test with cntlm –c cntlm.ini –I –M http://www.google.co.uk