This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Block Steam's internet access using iptables | |
# Script must be run as a user with root (or one that has | |
# permissions to play with iptables) | |
# | |
# | |
# Why did i need it? Even when running in offline mode | |
# steam would keep trying to login and then once every | |
# while it'd end my dota bota match saying "Connection | |
# Lost". |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Keep retrying some job till it executes successfully | |
# | |
# I primarily use this script to download files from servers | |
# that break the connection after certain minutes. Combining | |
# this with aria2c makes a really awesome sure-fire way to | |
# download your files. | |
# | |
carryOutJob() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/.bash/aliases/apt | |
################## | |
# APT | |
################## | |
#alias apt-fast='~/scripts/apt-fast.sh' | |
#alias sagif='sudo apt-fast install -f' | |
#alias sagi='sudo apt-fast install' | |
#alias sagur='sudo apt-fast upgrade' | |
#alias sacs='sudo apt-cache search' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# find partition name for a given filename | |
findpart() { [ -e "$1" ] && df -P "$1" | awk '/^\/dev/ {print $1}' || echo "$1 not found"; } | |
# Verbose version of sleep | |
countdown() | |
{ | |
secs=$1 | |
while [ $secs -gt 0 ]; do | |
echo -ne "$secs\033[0K\r" | |
sleep 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Usage: $0 {hostname} {port} {pathToScriptToExecuteIfPortIsNotAccessibleSayRestartApacheScript} | |
echo "" | nc $1 $2 && echo $? &>> /dev/null || $3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo substr(str_replace('+', '.', base64_encode(pack('N4', mt_rand(), mt_rand(), mt_rand(), mt_rand()))), 0, 22) . PHP_EOL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -ne 3 ] | |
then | |
echo "Usage: $0 sourceExtension /path/to/source/files /path/to/save/converted/files" | |
exit 65 | |
fi | |
cd "$2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Most of the code below has been adapted from several different scripts | |
mkdir -p /tmp/adblock &> /dev/null | |
temphosts1=`mktemp` | |
temphosts2=`mktemp` | |
# I prefer to separate adblock entries from my vanilla hosts file. | |
# I also use dnsmasq, which allows me to chain-load an additional | |
# hosts file, which is what i have done here. | |
target_file=/etc/hosts.dnsmasq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# I am mostly working in either of 2 modes: | |
# 1- work [ pass 'work' as first argument ] | |
# 2- not-work [ default] | |
# | |
# And over the years I have found it to be a pain to have to | |
# manually start the same 5-6 prorgams everytime my laptop | |
# got rebooted so I created a script with those presets | |
# and then set openbox to start the relevant workspace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
E_BADARGS=65 | |
if [ $# -ne 2 -a $# -ne 1 ] | |
then | |
echo "Usage: $0 {processNameWithoutSpaces} [{signal}]" | |
exit $E_BADARGS | |
fi | |
process_name="$1" |
OlderNewer