commit 2e26af92ccbaab746976e7290be035fab195126c
Author: dsorber <david.sorber@gmail.com>
Date:   Sun Nov 10 12:39:39 2013 -0500

    Adding the phalanx apache configs. Also adding two miscellaneous python scripts I wrote.

diff --git a/configs/apache/main b/configs/apache/main
new file mode 100644
index 0000000..bf6c032
--- /dev/null
+++ b/configs/apache/main
@@ -0,0 +1,43 @@
+<VirtualHost *:80>
+	Redirect permanent / https://10.0.0.6
+</VirtualHost>
+
+<VirtualHost _default_:443>
+        ServerAdmin webmaster@localhost
+
+        DocumentRoot /var/www
+        <Directory />
+                Options FollowSymLinks
+                AllowOverride None
+        </Directory>
+        <Directory /var/www/>
+                Options Indexes FollowSymLinks MultiViews
+                AllowOverride None
+                Order allow,deny
+                Allow from all
+        </Directory>
+
+        Alias /htdocs /var/htdocs
+        <Directory /var/htdocs>
+                Order allow,deny
+                Allow from all
+        </Directory>
+
+        WSGIScriptAlias /bfcs /home/dsorber/bfcs/app.wsgi
+	
+	ErrorDocument 403 /error_pages/404.html
+	ErrorDocument 404 /error_pages/404.html
+
+        ErrorLog ${APACHE_LOG_DIR}/error.log
+
+        # Possible values include: debug, info, notice, warn, error, crit,
+        # alert, emerg.
+        LogLevel warn
+
+        CustomLog ${APACHE_LOG_DIR}/access.log combined
+	SSLEngine On
+	SSLCertificateFile /etc/apache2/ssl/server.crt
+	SSLCertificateKeyFile /etc/apache2/ssl/server.key
+	SSLProtocol -all +TLSv1
+	SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
+</VirtualHost>
diff --git a/configs/apache/stuff b/configs/apache/stuff
new file mode 100644
index 0000000..9d9900b
--- /dev/null
+++ b/configs/apache/stuff
@@ -0,0 +1,7 @@
+<Location /stuff>
+	AuthType Digest
+	AuthName "stuff"
+	AuthDigestProvider file
+	AuthUserFile /home/dsorber/web_users
+	Require valid-user
+</Location>
diff --git a/configs/apache/trac b/configs/apache/trac
new file mode 100644
index 0000000..9d01306
--- /dev/null
+++ b/configs/apache/trac
@@ -0,0 +1,23 @@
+WSGIScriptAlias /trac /home/dsorber/trac/projects/headquarters/trac.wsgi
+
+<Directory /home/dsorber/trac/projects/headquarters/>
+    	WSGIApplicationGroup %{GLOBAL}
+    	Order deny,allow
+    	Allow from all
+</Directory>
+
+<Location "/trac/login">
+        AuthType Digest
+        AuthName "trac"
+        AuthDigestProvider file
+        AuthUserFile /home/dsorber/web_users
+        Require valid-user
+</Location>
+
+Alias /trac/chrome/common /home/dsorber/trac/projects/headquarters/htdocs/common
+Alias /trac/chrome/site /home/dsorber/trac/projects/headquarters/htdocs/site
+
+<Directory "/home/dsorber/trac/projects/headquarters/htdocs">
+  Order allow,deny
+  Allow from all
+</Directory>
diff --git a/configs/apache/transmission b/configs/apache/transmission
new file mode 100644
index 0000000..128e087
--- /dev/null
+++ b/configs/apache/transmission
@@ -0,0 +1,10 @@
+ProxyRequests Off
+<Location /transmission>
+	AuthType Digest
+	AuthName "engine"
+	AuthDigestProvider file
+	AuthUserFile /home/dsorber/web_users
+	Require valid-user
+	ProxyPass http://10.0.0.6:9565/transmission
+	ProxyPassReverse http://10.0.0.6:9565/transmission
+</Location>
diff --git a/misc/popcount_alg.py b/misc/popcount_alg.py
new file mode 100644
index 0000000..25aa368
--- /dev/null
+++ b/misc/popcount_alg.py
@@ -0,0 +1,58 @@
+import sys
+
+def popcount(i):
+	i = i - ((i >> 1) & 0x55555555)
+	i = (i & 0x33333333) + ((i >> 2) & 0x33333333)
+	return ((((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) & 0xFFFFFFFF) >> 24
+
+def main():
+	print 'Popcount Algorithm Overview\n'
+	
+	#i = i - ((i >> 1) & 0x55555555);
+    #i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
+    #return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
+	
+	uint = raw_input('Enter a 32 bit unsigned number> ')
+	if uint.startswith('0x'):
+		uint = int(uint, 16) & 0xFFFFFFFF
+	else:
+		uint = int(uint) & 0xFFFFFFFF
+	print
+
+	#i = i - ((i >> 1) & 0x55555555);
+	print 'Step  0: Input number:                                       {:>10d} -- hex: 0x{:08X}'.format(uint, uint)
+	op_step1 = (uint >> 1)
+	print 'Step  1: (i >> 1):                                           {:>10d} -- hex: 0x{:08X}'.format(op_step1, op_step1)
+	op_step2 = op_step1 & 0x55555555
+	print 'Step  2: ((i >> 1) & 0x55555555):                            {:>10d} -- hex: 0x{:08X}'.format(op_step2, op_step2)
+	op_step3 = uint - op_step2
+	print 'Step  3: i - ((i >> 1) & 0x55555555):                        {:>10d} -- hex: 0x{:08X}'.format(op_step3, op_step3)
+	print
+	
+	#i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
+	op_step4 = op_step3 & 0x33333333
+	print 'Step  4: (i & 0x33333333):                                   {:>10d} -- hex: 0x{:08X}'.format(op_step4, op_step4)
+	op_step5 = op_step3 >> 2
+	print 'Step  5: (i >> 2):                                           {:>10d} -- hex: 0x{:08X}'.format(op_step5, op_step5)
+	op_step6 = op_step5 & 0x33333333
+	print 'Step  6: ((i >> 2) & 0x33333333):                            {:>10d} -- hex: 0x{:08X}'.format(op_step6, op_step6)
+	op_step7 = op_step4 + op_step6
+	print 'Step  7: (i & 0x33333333) + ((i >> 2) & 0x33333333):         {:>10d} -- hex: 0x{:08X}'.format(op_step7, op_step7)
+	print
+	
+	#ans = (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24
+	op_step8 = op_step7 >> 4
+	print 'Step  8: (i >> 4):                                           {:>10d} -- hex: 0x{:08X}'.format(op_step8, op_step8)
+	op_step9 = op_step7 + op_step8
+	print 'Step  9: (i + (i >> 4)):                                     {:>10d} -- hex: 0x{:08X}'.format(op_step9, op_step9)
+	op_step10 = op_step9 & 0x0F0F0F0F
+	print 'Step 10: ((i + (i >> 4)) & 0x0F0F0F0F):                      {:>10d} -- hex: 0x{:08X}'.format(op_step10, op_step10)
+	op_step11 = (op_step10 * 0x01010101) & 0xFFFFFFFF
+	print 'Step 11: (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101):       {:>10d} -- hex: 0x{:08X}'.format(op_step11, op_step11)
+	op_step12 = op_step11 >> 24
+	print 'Step 12: (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24: {:>10d} -- hex: 0x{:08X}'.format(op_step12, op_step12)
+	print
+	print 'Popcount: {:d}'.format(popcount(uint))
+	
+if __name__ == '__main__':
+	sys.exit(main())
diff --git a/misc/unbruce.py b/misc/unbruce.py
new file mode 100644
index 0000000..d70c69a
--- /dev/null
+++ b/misc/unbruce.py
@@ -0,0 +1,17 @@
+import os
+import sys
+
+def main():
+
+	for file in os.listdir(sys.argv[1]):
+		if file.startswith('www-bruce-juice-com-') or \
+		   file.startswith('www-bruce-juice-com_'):
+			print '%s ---> %s' % (file, file[20:])
+			os.rename(file, file[20:])
+		elif file.startswith('www-bangtidy-net-') or \
+		     file.startswith('www-bangtidy-net_'):
+			print '%s ---> %s' % (file, file[17:])
+			os.rename(file, file[17:])
+
+if __name__ == '__main__':
+	sys.exit(main())
\ No newline at end of file
