Skip to content

Instantly share code, notes, and snippets.

View mpasternacki's full-sized avatar

Maciej Pasternacki mpasternacki

View GitHub Profile
@mpasternacki
mpasternacki / cl-md5-salted-passwords.lisp
Created November 23, 2009 12:16
Salted password hashes with CL-MD5.
;;; This program is free software. It comes without any warranty, to
;;; the extent permitted by applicable law. You can redistribute it
;;; and/or modify it under the terms of the Do What The Fuck You Want
;;; To Public License, Version 2, as published by Sam Hocevar. See
;;; http://sam.zoy.org/wtfpl/COPYING for more details.
(defparameter +hash-salt-chars+ "qwertyuiopasdfghjklzxcvbnm")
(defparameter +salt-length+ 5)
(defun md5str (password)
"Return string form of PASSWORD's MD5sum."
@mpasternacki
mpasternacki / django-paypal-dateutil.diff
Created November 11, 2009 18:21
Monkey-patch django-paypal for issue #17
diff --git a/standard/forms.py b/standard/forms.py
index 6639146..f13aae4 100644
--- a/standard/forms.py
+++ b/standard/forms.py
@@ -199,12 +199,52 @@ class PayPalSharedSecretEncryptedPaymentsForm(PayPalEncryptedPaymentsForm):
else:
self.fields['notify_url'].initial += secret_param
+try:
+ import dateutil.parser
diff -u /usr/lib/ruby/user-gems/1.8/gems/capistrano-2.5.9/lib/capistrano/recipes/deploy.rb /var/folders/ES/ESqLaiVrElWZyCirD8h3nk\+\+\+TI/-Tmp-/buffer-content-411Nzk
--- /var/folders/ES/ESqLaiVrElWZyCirD8h3nk+++TI/-Tmp-/buffer-content-411Nzk 2009-10-19 12:23:17.000000000 +0200
+++ /usr/lib/ruby/user-gems/1.8/gems/capistrano-2.5.9/lib/capistrano/recipes/deploy.rb 2009-10-19 11:41:04.000000000 +0200
@@ -51,7 +51,7 @@
_cset(:release_path) { File.join(releases_path, release_name) }
_cset(:releases) { capture("ls -xt #{releases_path}").split.reverse }
-_cset(:current_release) { File.join(releases_path, releases.last) }
+_cset(:current_release) { File.join(releases_path, releases.last || "*LATEST_RELEASE*") }
_cset(:previous_release) { releases.length > 1 ? File.join(releases_path, releases[-2]) : nil }
@mpasternacki
mpasternacki / pingfcgi.sh
Created October 13, 2009 18:40
Ping FCGI server, using cgi-fcgi program from libfcgi library.
#!/bin/sh
set -e
# Ping FCGI server. Uses cgi-fcgi program from libfcgi library.
# Retrieves the root path (/) from host:port specified on command line.
if [ -z "$1" ] ; then
echo "Usage: $0 host:port|path/to/socket" >&2
exit 1
fi
@mpasternacki
mpasternacki / duplicity-runner.sh
Created September 23, 2009 19:19
Script for easy Duplicity backup, suitable for both /etc/cron.daily/ and running by hand.
#!/bin/sh
set -e
local=/
remote=s3+http://***/
# figure out correct positional arg order for duplicity
case $1 in
''|full|incremental) positional="$local $remote" ;;
restore|verify) positional="$remote $local" ;;
*) positional="$remote" ;;
@mpasternacki
mpasternacki / smart_ipython
Created September 8, 2009 10:19
Smart IPython script for comfortably running Django's manage.py shell with ipython.el
#!/bin/sh
set -e
/bin/echo -n "Select Django project/dir, or press enter for plain ipython: "
read selection
case $selection in
'') exec ipython ;;
sj) cd /Users/japhy/Projekty/SetJam/setjam/setjam ;;
*) cd $selection ;;