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 | |
TEMPFILE=`mktemp -p /tmp` | |
HOSTNAME=`hostname` | |
MASTERS="xx.xx.xx.xx" | |
REMOTE_URI="[email protected]" | |
for domain in `/bin/grep ^zone /etc/named.conf | /bin/grep "type master" | /bin/ | |
awk '{print $2}' | /bin/awk -F\" '{print $2}'` | |
do | |
/usr/bin/printf "zone \"${domain}\" {\n type slave;\n file \"/var/named/slaves/${domain}.db\";\n masters { ${MASTERS}; };\n};\n\n" |
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 | |
function setup { | |
if [ ! -d ~/.ssh ]; then | |
echo "SSH folder doesn't exist, creating..." | |
mkdir ~/.ssh | |
fi | |
if [ ! -d ~/keys ]; then | |
echo "Keys folder doesn't exist, creating..." |
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
module Linux | |
class User | |
class << self | |
# Generate an MD5 salt string | |
def salt | |
seeds = ('a'..'z').to_a | |
seeds.concat( ('A'..'Z').to_a ) | |
seeds.concat( (0..9).to_a ) |
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 | |
case "$SSH_ORIGINAL_COMMAND" in | |
*\&*) | |
echo "Rejected" | |
;; | |
*\(*) | |
echo "Rejected" | |
;; | |
*\{*) |
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 | |
/usr/bin/sa-update | |
if [ $? -eq 0 ]; then | |
# New rules were installed. Restart spamd | |
echo 'New spamassassin rules available and installed. Restarting spamassassin' | |
pkill -9 -f /usr/bin/spamd | |
/usr/bin/spamd -d -c -m 5 | |
exit 0 | |
else |
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
location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ { | |
expires max; | |
log_not_found off; | |
} | |
location / { | |
try_files $uri $uri/ /index.php; | |
} | |
location ~* \.php$ { |
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
class Application < Sinatra::Base | |
enable :inline_templates | |
get '/:folder' do |folder| | |
if File.directory? 'uploads/' + folder | |
@files = Dir.glob('uploads/' + folder + '/*') | |
@folder = folder | |
erb :index | |
else | |
'No files' |
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
Domain | |
is invalid without a unique name | |
is invalid without master if slave? | |
is invalid without a name | |
is invalid if master not a valid IP | |
is invalid if type is not NATIVE MASTER or SLAVE | |
should have a valid factory | |
#slave? | |
should be true if type == SLAVE |
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
check process apache with pidfile /var/run/apache2.pid | |
start program = "/etc/init.d/apache2 start" with timeout 60 seconds | |
stop program = "/etc/init.d/apache2 stop" | |
if cpu > 60% for 2 cycles then alert | |
if cpu > 80% for 5 cycles then restart | |
if totalmem > 200.0 MB for 5 cycles then restart | |
if failed host localhost port 80 protocol http then restart | |
if 3 restarts within 5 cycles then timeout |
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 | |
### Run with | |
# while (nc -e info.sh -v -l -p 1025); do sleep 1; done | |
# | |
users() { | |
who | cut -f1 -d ' ' | uniq | awk -v ORS=, '{ print "\042"$1"\042" }' | sed 's/,$//' | |
} |
OlderNewer