Skip to content

Instantly share code, notes, and snippets.

from flask_rage import app as application
<VirtualHost *>
ServerName hostsite.com
WSGIDaemonProcess flask_rage user=my_username group=group1 threads=5
WSGIScriptAlias / /var/www/ragetext/flask_rage.wsgi
<Directory /var/www/ragetext>
WSGIProcessGroup flask_rage
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
def foo():
for x in range(5):
yield x
yield x*2
(letfn [(first [x]
(lazy-seq
(when (<= x 5)
(cons x (second x)))))
(second [x]
(def denoms [1000 500 100 25 5 1])
(def names {2000 :twenties
1000 :tens
500 :fives
100 :dollars
25 :quarters
5 :nickels
1 :pennies})
(def denoms [1000 500 100 25 5 1])
(def names {2000 :twenties
1000 :tens
500 :fives
100 :dollars
25 :quarters
5 :nickels
1 :pennies})
(def denoms [1000 500 100 25 5 1])
(def names {2000 :twenties
1000 :tens
500 :fives
100 :dollars
25 :quarters
5 :nickels
1 :pennies})
@mattdeboard
mattdeboard / spotify.el
Created August 6, 2011 23:05
Small minor mode to control spotify from emacs
;;Small minor mode to control spotify from emacs
(defun spotify-play () "Play Spotify" (interactive)
(shell-command "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Play"))
(defun spotify-pause () "Pause Spotify" (interactive)
(shell-command "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Pause"))
(defun spotify-playpause () "Play/Pause Spotify" (interactive)
(shell-command "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause"))
@mattdeboard
mattdeboard / apache2.conf
Created August 25, 2011 13:22
Apache2.conf patch
<snip>
LoadModule setenvif_module /usr/lib/apache2/modules/mod_setenvif.so
# Drop the Range header when more than 5 ranges.
# CVE-2011-3192
SetEnvIf Range (,.*?){5,} bad-range=1
RequestHeader unset Range env=bad-range
# bad-range logging
CustomLog logs/range-CVE-2011-3192.log common env=bad-range
if site_config.browse_facet_show and facets:
range = http_request_header['Range'] # would be of type list in this example
def request_header(bad_range):
if bad_range:
range = None
return range
def setenvif():
bad_range = None
if len(range) > 5: