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
#!/bin/bash
#
# This Script sets a random root password, disables the root user and deletes itself afterwards!
# Put this Script in the "/etc/rc5.d/" directory.
#
# Version: 1.0
# Author: ham5ter@ham5ter.de
# Date 02.08.2016
genpasswd() {
@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
#/bin/bash
#
# This script is used to Create a User Account with SUDO Privileges!!!,
# Display the Password and force the User to change that Password upon the first Login!
#
# Version: 1.0
# Author: ham5ter@ham5ter.de
# Date: 02.08.2016
@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
# Clean up Package Management
apt-get -y remove linux-headers-$(uname -r) build-essential
apt-get -y autoremove
apt-get -y clean
# Removing DHCP leases
echo "cleaning up dhcp leases"
rm /var/lib/dhcp/*
# Make sure Udev doesn't block our network
@Ham5ter
Ham5ter / minimize.sh
Last active July 26, 2016 12:15
This
#!/bin/bash
# Zero out all the remaining Space of a Virtual Machines Filesystem for Image Creation
dd if=/dev/zero of=/EMPTY bs=1M
sync
rm -f /EMPTY
@Ham5ter
Ham5ter / salt-bootstrap.sh
Last active July 14, 2016 12:52
salt-bootstrap.sh
#!/bin/bash
apt-get update
apt-get install wget -y
wget -O - https://repo.saltstack.com/apt/ubuntu/14.04/amd64/latest/SALTSTACK-GPG-KEY.pub | sudo apt-key add -
echo "deb http://repo.saltstack.com/apt/ubuntu/14.04/amd64/latest trusty main" > /etc/apt/sources.list.d/saltstack.list
apt-get update
apt-get install salt-minion -y
cat << EOF > /etc/salt/minion
master: $1
EOF
@Ham5ter
Ham5ter / script_directory.sh
Created June 29, 2016 11:24
This sets the variable "SCRIPT_DIRECTORY" to the Path, the Script is in.
#!/bin/bash
# This sets the variable "SCRIPT_DIRECTORY" to the Path, the Script is in.
SCRIPT_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
@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 / install_salt-master.sh
Created June 15, 2016 23:39
basic salt-master installation on Ubuntu 16.04
#!/bin/bash
# run with root privileges
# basic salt-master installation on Ubuntu 16.04
apt-get update
apt-get install wget -y
wget -O - https://repo.saltstack.com/apt/ubuntu/16.04/amd64/latest/SALTSTACK-GPG-KEY.pub | sudo apt-key add -
echo "deb http://repo.saltstack.com/apt/ubuntu/16.04/amd64/latest xenial main" > /etc/apt/sources.list.d/saltstack.list
apt-get update