Skip to content

Instantly share code, notes, and snippets.

Maciej Pasternacki mpasternacki

Block or report user

Report or block mpasternacki

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

Keybase proof

I hereby claim:

  • I am mpasternacki on github.
  • I am mpasternacki ( on keybase.
  • I have a public key whose fingerprint is 5810 5238 081B 0C33 46BF A0F5 A43B 1DDA E9A0 8CCF

To claim this, I am signing this object:

mpasternacki / smart_ipython
Created Sep 8, 2009
Smart IPython script for comfortably running Django's shell with ipython.el
View smart_ipython
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 ;;
mpasternacki /
Created Sep 23, 2009
Script for easy Duplicity backup, suitable for both /etc/cron.daily/ and running by hand.
set -e
# figure out correct positional arg order for duplicity
case $1 in
''|full|incremental) positional="$local $remote" ;;
restore|verify) positional="$remote $local" ;;
*) positional="$remote" ;;
mpasternacki /
Created Oct 13, 2009
Ping FCGI server, using cgi-fcgi program from libfcgi library.
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
View capistrano-current_release_with_dry-run.diff
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 / django-paypal-dateutil.diff
Created Nov 11, 2009
Monkey-patch django-paypal for issue #17
View django-paypal-dateutil.diff
diff --git a/standard/ b/standard/
index 6639146..f13aae4 100644
--- a/standard/
+++ b/standard/
@@ -199,12 +199,52 @@ class PayPalSharedSecretEncryptedPaymentsForm(PayPalEncryptedPaymentsForm):
self.fields['notify_url'].initial += secret_param
+ import dateutil.parser
mpasternacki /
Created Nov 23, 2009
Local ASDF-Install Sandbox

Local ASDF-Install Sandbox

I needed an installation of ADSF-Install that wouldn’t interfere with system-wide, user-wide or even project-wide settings but that would allow me to fetch, e.g., Tinaa and document my project. So, I want to create ASDF-install sandbox that would be completely self-contained. And I did. Here’s how:

First, download ASDF-Install using darcs:

darcs get

Downloaded ASDF-install directory will be our sandox (yes, the self-contained sandbox is this self-contained it uses own local copy of ASDF-Install itself). Now, let’s create place for downloaded systems in sandbox and, to avoid overpopulating ASDF:*CENTRAL-REGISTRY*, symlink asdf-install itself there:

mpasternacki / cl-md5-salted-passwords.lisp
Created Nov 23, 2009
Salted password hashes with CL-MD5.
View cl-md5-salted-passwords.lisp
;;; 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
;;; for more details.
(defparameter +hash-salt-chars+ "qwertyuiopasdfghjklzxcvbnm")
(defparameter +salt-length+ 5)
(defun md5str (password)
"Return string form of PASSWORD's MD5sum."
mpasternacki / tail-n-mail.rb
Created Jan 8, 2010
Periodically send new lines in log file to specified email address.
View tail-n-mail.rb
# Script to periodically send new lines in log file to specified mail address.
# Similar to - but I needed
# substitution to handle newlines in Python-generated messages, and it
# was faster to homebrew my own script than to add features to an
# already overfeatured Perl script. And I want to practice Ruby - seems
# to be fine for small, one-off scripts.
# License: WTFPL or MIT, whichever you prefer.
mpasternacki / htmlize-fragments.el
Created Jan 24, 2010
Replace fragment of current buffer with htmlized file.
View htmlize-fragments.el
(require 'htmlize)
(defun jph/strip-htmlized-buffer ()
"Strip htmlized buffer to <pre> tag, copying style attribute from <body> to <pre>."
(goto-char (point-min))
(re-search-forward "<body\\( style=[^>]*\\)>")
(let ((style (match-string 1)))
(search-forward "<pre")
(insert style)
You can’t perform that action at this time.