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 Enum < Hash | |
def initialize(*members) | |
super() | |
@rev = {} | |
members.each_with_index {|m,i| self[i] = m } | |
end | |
def [](k) | |
super || @rev[k] # || raise ArgumentError, "#{k} is not a member of this enum" | |
end | |
def []=(k,v) |
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
# encoding : utf-8 | |
require 'openssl' | |
require 'digest/sha1' | |
require 'base64' | |
module Aws | |
extend self | |
def signed_url(path, expire_date) | |
digest = OpenSSL::Digest::Digest.new('sha1') | |
can_string = "GET\n\n\n#{expire_date}\n/#{S3_BUCKET}/#{path}" |
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
<VirtualHost *:80> | |
ServerName sc-msg.khnum-3 | |
DocumentRoot /s/sc-msg/current/public | |
RailsEnv staging | |
SetEnv JAVA_HOME /usr/lib/jvm/java-1.7.0 | |
ErrorLog logs/staging.errors.sc-msg.log | |
CustomLog logs/staging.access.sc-msg.log common | |
<Directory /s/sc-msg/current/public> | |
AllowOverride all | |
Options -MultiViews |
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
cd ~ | |
sudo tar cfz joomlabackup.tar.gz /var/www/cms/2 | |
mysqldump -u cms-1 -p$CMSPW cms-1 > cms-1.out | |
tar cfz cms-1-combined-`date +'%Y%m%d%H%M'`.tar.gz joomlabackup.tar.gz cms-1.out | |
rm -f joomlabackup.tar.gz cms-1.out | |
chmod a-w ~/cms-1-combined-`date +'%Y%m%d%H%M'`.tar.gz | |
# FILES=~/cms-1-combined-*.tar.gz | |
#echo ${FILES[@]} | |
# echo $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
# Flush all rules | |
sudo iptables -F | |
# If a pre-existing connection exists, allow it | |
sudo iptables -A INPUT -p tcp -m state --state RELATED,ESTABLISHED -j ACCEPT | |
sudo iptables -A INPUT -p udp -m state --state RELATED,ESTABLISHED -j ACCEPT | |
# Setup bi-directional ping for this hosts internal address | |
SERVER_IP="192.168.130.189" | |
sudo iptables -A INPUT -p icmp --icmp-type 8 -s 0/0 -d $SERVER_IP -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT |
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
# config for iptables - dns-httpd-ntpd-openvpn-openvpnas-ssh | |
# Flush tables for a clean start | |
sudo iptables -F | |
# Accept connectons that were established | |
sudo iptables -A INPUT -p tcp -m state --state ESTABLISHED,RELATED -j ACCEPT | |
sudo iptables -A INPUT -p udp -m state --state ESTABLISHED,RELATED -j ACCEPT | |
sudo iptables -A OUTPUT -o eth0 -p tcp -m state --state RELATED,ESTABLISHED -j ACCEPT | |
sudo iptables -A OUTPUT -o eth0 -p udp -m state --state RELATED,ESTABLISHED -j ACCEPT |
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
sudo iptables -F | |
sudo iptables -A INPUT -p tcp -m state --state ESTABLISHED,RELATED -j ACCEPT | |
sudo iptables -A INPUT -p udp -m state --state ESTABLISHED,RELATED -j ACCEPT | |
sudo iptables -I INPUT -i lo -j ACCEPT | |
sudo iptables -I INPUT -i tun0 -j ACCEPT | |
sudo iptables -A OUTPUT -o eth0 -p tcp --dport 1194 -m state --state ESTABLISHED -j ACCEPT | |
sudo iptables -A INPUT -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT | |
sudo iptables -A OUTPUT -o eth0 -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT | |
sudo iptables -A INPUT -i eth0 -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT | |
sudo iptables -A OUTPUT -o eth0 -p tcp --sport 443 -m state --state ESTABLISHED -j ACCEPT |
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
sudo iptables -F | |
sudo iptables -A INPUT -p tcp -m state --state ESTABLISHED,RELATED -j ACCEPT | |
sudo iptables -A INPUT -p udp -m state --state ESTABLISHED,RELATED -j ACCEPT | |
sudo iptables -I INPUT -i lo -j ACCEPT | |
sudo iptables -I INPUT -i tun0 -j ACCEPT | |
sudo iptables -A OUTPUT -o eth0 -p tcp --dport 1194 -m state --state ESTABLISHED -j ACCEPT | |
sudo iptables -A INPUT -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT | |
sudo iptables -A OUTPUT -o eth0 -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT | |
sudo iptables -A INPUT -i eth0 -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT | |
sudo iptables -A OUTPUT -o eth0 -p tcp --sport 443 -m state --state ESTABLISHED -j ACCEPT |
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
sudo iptables -F | |
sudo iptables -I INPUT -i lo -j ACCEPT | |
sudo iptables -I INPUT -i tun0 -j ACCEPT | |
sudo iptables -A INPUT -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT | |
sudo iptables -A OUTPUT -o eth0 -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT | |
sudo iptables -A INPUT -i eth0 -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT | |
sudo iptables -A OUTPUT -o eth0 -p tcp --sport 443 -m state --state ESTABLISHED -j ACCEPT | |
sudo iptables -A INPUT -i eth0 -p tcp --dport ssh -m state --state NEW,ESTABLISHED -j ACCEPT | |
sudo iptables -A OUTPUT -o eth0 -p tcp --sport ssh -m state --state ESTABLISHED -j ACCEPT | |
sudo iptables -A INPUT -j DROP |
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
sudo iptables -F | |
sudo iptables -I INPUT -i lo -j ACCEPT | |
sudo iptables -I INPUT -i tun0 -j ACCEPT | |
sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT | |
sudo iptables -A OUTPUT -o eth0 -p tcp --dport 1194 -m state --state ESTABLISHED -j ACCEPT | |
sudo iptables -A INPUT -i eth0 -p tcp --dport ssh -m state --state NEW,ESTABLISHED -j ACCEPT | |
sudo iptables -A OUTPUT -o eth0 -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT | |
sudo iptables -A INPUT -j DROP | |
sudo iptables -A OUTPUT -j DROP | |
sudo iptables -A FORWARD -j DROP |
NewerOlder