Skip to content

Instantly share code, notes, and snippets.

@ipartola
ipartola / .vimrc
Created February 15, 2016 15:29
vim configuration for transparent editing of gpg encrypted files
" Transparent editing of gpg encrypted files.
augroup encrypted
au!
" First make sure nothing is written to ~/.viminfo while editing
" an encrypted file.
autocmd BufReadPre,FileReadPre *.gpg set viminfo=
" We don't want a swap file, as it writes unencrypted data to disk
autocmd BufReadPre,FileReadPre *.gpg set noswapfile
" Switch to binary mode to read the encrypted file
autocmd BufReadPre,FileReadPre *.gpg set bin
@ipartola
ipartola / JavaScript-and-jQuery.md
Created February 9, 2016 16:52
JavaScript and jQuery notes

JavaScript, the DOM, and jQuery

This talk will cover JavaScript, the DOM, and jQuery as three separate subjects. Why? Because they are all interrelated.

Part 1: JavaScript

  • JavaScript goes by many names. The original was Mocha and LiveScript. The more politically correct modern name is ECMAScript, but that sounds like a skin disease, so we don't use it.
  • Developed in 10 days in 1995 by Brendan Eich and Netscape.

Keybase proof

I hereby claim:

  • I am ipartola on github.
  • I am ipartola (https://keybase.io/ipartola) on keybase.
  • I have a public key whose fingerprint is 4A85 10E3 3536 44EE 02E3 F522 B2AC 08B5 2272 781B

To claim this, I am signing this object:

from __future__ import print_function, unicode_literals, division, absolute_import
import sys
from zc.lockfile import LockFile, LockError
lockfile_name = '/tmp/foo-bar.txt'
try:
lock = LockFile(lockfile_name)
except LockError:
#! /bin/sh
#
# Downloaded from:
# http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/trusty/supervisor/trusty/view/head:/debian/supervisor.init
#
# skeleton example file to build /etc/init.d/ scripts.
# This file should be used to construct scripts for /etc/init.d.
#
# Written by Miquel van Smoorenburg <miquels@cistron.nl>.
# Modified for Debian
@ipartola
ipartola / fizzbuzz.py
Last active December 26, 2015 20:19
FizzBuzz using Python generators
def fizz():
while True:
yield ''
yield ''
yield 'fizz'
def buzz():
while True:
yield ''
yield ''
@ipartola
ipartola / settings_logging.py
Created November 14, 2012 16:06
Generic Django 1.3 logging settings
# Place this in your Django 1.3+ settings.py file
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'simple': {
'format': '%(asctime)s %(levelname)s %(message)s'
},
'verbose': {