Project

General

Profile

« Previous | Next » 

Revision 2e26af92

Added by dsorber over 12 years ago

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

View differences:

configs/apache/main
<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>
configs/apache/stuff
<Location /stuff>
AuthType Digest
AuthName "stuff"
AuthDigestProvider file
AuthUserFile /home/dsorber/web_users
Require valid-user
</Location>
configs/apache/trac
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>
configs/apache/transmission
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>
misc/popcount_alg.py
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())
misc/unbruce.py
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())

Also available in: Unified diff