Skip to content

Instantly share code, notes, and snippets.

@randomessence
randomessence / nukeit.sh
Created November 6, 2015 11:42
nukeit.sh
#!/bin/bash
# Nuke it, baby
#
# I recommend you fork this script and set your protected slots if you have multiple and wish to make sure there is a specific slot that can't get nuked.
#
# You can enter your protected servers here so that slots on this server are immune to the script. It is unlikely to have multiple slots per server for a user.
protected=("metis")
#
if [[ "$(hostname)" = "$(echo ${protected[@]} | grep -o $(hostname))" ]]
then
@randomessence
randomessence / mdp.sh
Created September 23, 2015 12:55
Music Player Daemon
wget http://www.musicpd.org/download/mpd/0.19/mpd-0.19.10.tar.xz
tar xf mpd-0.19.10.tar.xz && cd mpd-0.19.10/
./configure --prefix=$HOME
make && make install
cd && rm -rf mpd-0.19.10{.tar.xz,}
@randomessence
randomessence / dstat.sh
Created September 7, 2015 18:21
Install dstat locally
git clone https://github.com/dagwieers/dstat.git && cd ~/dstat/
make install prefix=$HOME && cd && rm -rf ~/dstat
~/bin/dstat
@randomessence
randomessence / nuke.sh
Last active February 20, 2022 23:44
nuke it
#!/bin/bash
# Nuke it, baby
#
if [[ "$(hostname)" = 'metis' ]]
then
echo
echo -e "\033[36m""This is the metis slot, i am exiting""\e[0m"
echo
exit
# wget -qO ~/instances http://git.io/vvkIu
# crontab -e
# * * * * * bash -l ~/instances
#######################################################################################################################################
suffix="1"
# rtorrent
if [[ -z "$(ps x | grep -v grep | grep -o '/bin/bash -e /usr/local/bin/rtorrent -n -o import='"$HOME"'/.rtorrent-'"$suffix"'.rc')" ]]
then
screen -fa -dmS rtorrent-"$suffix" rtorrent -n -o import=~/.rtorrent-"$suffix".rc
echo "$(date +"%d.%m.%y@%H:%M:%S")" rtorrent-"$suffix" >> ~/screenlogs.txt
@randomessence
randomessence / instances.sh
Last active August 29, 2015 14:18
multirtru restart
# wget -qO ~/instances http://git.io/vvkfk
# crontab -e
# * * * * * bash -l ~/instances
#######################################################################################################################################
suffix="1"
# rtorrent
if [[ -z "$(ps x | grep -v grep | grep -o '/bin/bash -e /usr/local/bin/rtorrent -n -o import='"$HOME"'/.rtorrent-'"$suffix"'.rc')" ]]
then
@randomessence
randomessence / variabletest.sh
Last active August 29, 2015 14:17
variable expansion
# Make the test folder we will work in.
mkdir -p ~/mytest && cd ~/mytest
# Export the test variables.
export testvar1="000 111 222 333 444" && export testvar2="555 666 777 888 999"
# create a folder using command or paramter substitution and testvar1
mkdir $(echo $testvar1) && ls