Skip to content

Instantly share code, notes, and snippets.

View Ham5ter's full-sized avatar
☠️
This account is Dead, Head over to: https://github.com/keyboardinterrupt/

Ham5ter Ham5ter

☠️
This account is Dead, Head over to: https://github.com/keyboardinterrupt/
View GitHub Profile
@Ham5ter
Ham5ter / regenerate_ssh_host_keys_init.sh
Last active October 9, 2022 15:38
regenerate openssh-keys on first boot!
#!/bin/bash
#
# This Script Regenerates the OpenSSH Host Keys, and deletes itself afterwards!
# Put this Script in the "/etc/rc5.d/" directory.
#
# Version: 1.1
# Author: ham5ter@ham5ter.de
# Date 02.08.2016
# SPDX-License-Identifier: MIT
@Ham5ter
Ham5ter / live_grow_lvm.sh
Last active March 16, 2022 19:08
This Script is an example for growing a Simple LVM inside a virtual machine, without downtime.
# Dont just copy and paste it!
# i am not responsible for any dataloss or other damage!
### grow the Disk in vSphere ###
# Just do it, there is no way to Script that
### rescan all SCSI Devices to detect the Change ###
for scsi in /sys/class/scsi_device/*/device/rescan; do
echo 1 > $scsi
done
@Ham5ter
Ham5ter / haproxy_corosync_pacemaker_ubuntu.md
Last active May 1, 2021 10:29
Set up HAProxy with Pacemaker/Corosync on Ubuntu 16.04

Set up HAProxy with Pacemaker/Corosync on Ubuntu 16.04

This Document roughly describes a HAProxy Cluster Setup on Ubuntu 16.04 based on an example Configuration with 3 Nodes

This Document is still work in Progress the Following Stuff still needs to be done:

  • Explain the crm configure steps
  • explain Miscellaneous CRM Commands for Cluster Management
  • Add all the external ressources used.
  • Add a simple HAProxy Configuration for testing purpouse
@Ham5ter
Ham5ter / install_check_mk_agent.bat
Last active April 23, 2021 03:44
This Script install the check-mk-agent and adds a Firewall Rule to the local Windows Firewall to allow Access to it!
::
:: This Script install the check-mk-agent and adds a Firewall Rule to the local Windows Firewall to allow Access to it!
:: https://gist.github.com/Ham5ter/2a8526e843c72ff9343bc3a38cdac97e
::
:: Allow ICMP Echo (Ping)
netsh advfirewall firewall delete rule name="ICMP Allow incoming V4 echo request"
netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow
:: Allow TCP Port 6556 (check-mk-agent)
# Create `/boot/` on `/dev/sda`
parted /dev/sda mklabel msdos
parted -a opt /dev/sda mkpart primary ext4 0% 100%
# Create LVM with `/` and `/var/` on `/dev/sdb`
pvcreate /dev/sdb
vgcreate centos /dev/sdb
lvcreate -l 35%FREE -n root centos
lvcreate -l 60%FREE -n var centos
lvcreate -l 100%FREE -n swap centos
@Ham5ter
Ham5ter / install_spotify_plugin_for_clementine.sh
Created February 8, 2016 13:28
install spotify plugin for clementine
VERSION="version14-64bit"
LIBSPOTIFY_VERSION="12.1.45"
#1. Create the folder where the plugin will be placed
mkdir -p ~/.config/Clementine/spotifyblob/$VERSION
#2. Download the plugin
cd ~/.config/Clementine/spotifyblob/$VERSION
wget http://spotify.clementine-player.org/$VERSION/blob
wget http://spotify.clementine-player.org/$VERSION/libspotify.so.$LIBSPOTIFY_VERSION
#3. Make sure the executable bit is set on the blob
chmod +x blob
@Ham5ter
Ham5ter / Type Clipboard
Created September 19, 2016 13:19
usefull for KVM and stuff where Clipboard does not work
#!/bin/sh
sh -c 'sleep 5; xdotool type --delay 20 "$(xclip -o -selection clipboard)"'
@Ham5ter
Ham5ter / crontab
Last active February 12, 2018 11:06
crontab example
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
#
# Aliases:
@Ham5ter
Ham5ter / Ubuntu 16.04 Cloud preperations.sh
Created January 19, 2017 14:04
Ubuntu 16.04 Cloud preperations
apt update && apt upgrade -y && apt remove unattended-upgrades -y && apt autoremove -y
apt-get clean
echo "blacklist floppy" | sudo tee /etc/modprobe.d/blacklist-floppy.conf
sudo rmmod floppy
sudo update-initramfs -u
# This Script enables all "offline" RAM and CPU ressources on linux
# If you i.e. added RAM to your Virtual Machine, you can use this one liner so that Linux detects the new offline RAM and adds it to its RAM Pool
# same for CPU's
grep -l offline /sys/devices/system/memory/*/state | while read line; do echo "online" > ${line}; done
grep -l 0 /sys/devices/system/cpu/cpu*/online | while read line; do echo "1" > ${line}; done