Skip to content

Instantly share code, notes, and snippets.

@olifante
olifante / crypto-wrong-answers.md
Created December 8, 2021 16:23 — forked from paragonie-scott/crypto-wrong-answers.md
An Open Letter to Developers Everywhere (About Cryptography)
@olifante
olifante / .bash_profile
Last active January 16, 2018 14:52 — forked from marioBonales/.bashrc
Default .bashrc for macOS
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
@olifante
olifante / .bashrc
Created January 16, 2018 14:44 — forked from marioBonales/.bashrc
Default .bashrc for ubuntu
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
@olifante
olifante / filter_through_command.py
Created February 25, 2012 20:20 — forked from jefftriplett/filter_through_command.py
Sublime Text 2: "Filter Through Command" plugin
#!/usr/bin/env python
# -*- coding: utf-8 -*-
## based on http://pastie.org/private/bclbdgxzbkb1gs2jfqzehg
import sublime
import sublime_plugin
import subprocess
class PromptRunExternalCommand(sublime_plugin.WindowCommand):

This document has now been incorporated into the uWSGI documentation:

http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html

Set up Django, nginx and uwsgi

Steps with explanations to set up a server using:

@olifante
olifante / itunes.sql
Last active December 10, 2015 22:49 — forked from rkumar/itunes.sql
/* create tables to store itunes music library data for quick access
- olifante 2013 January - added columns used by iTunes 11.0.1
- rkumar 2010 July
*/
-- drop table tracks;
create table tracks (
album_artist VARCHAR(50),
album_rating_computed INTEGER,
album_rating INTEGER,
album VARCHAR(50),
@olifante
olifante / xml2db.rb
Created January 10, 2013 18:32 — forked from rkumar/xml2db.rb
#!/usr/bin/env ruby
=begin
* Name: xml.rb
* Description parses xml iTunes Music Library and inserts into database
so other apps can use, rather than each time parsing xml file
* Author: Original - Aaron Patterson (xml parsing portion)
http://groups.google.com/group/nokogiri-talk/browse_thread/thread/97973521c6f5f0dc
* Additions by rkumar
* Date: 2010-08-04
* License:
from django.core.paginator import ObjectPaginator
class QuickObjectPaginator(ObjectPaginator):
max_safe_pages = 0
def __init__(self, object_list, per_page, orphans=0, max_safe_pages=0):
self.max_safe_pages = max_safe_pages
super(QuickObjectPaginator, self).__init__(object_list, per_page, orphans)
def validate_page_number(self, page_number):
"Memcached cache backend"
from django.core.cache.backends import memcached
from django.utils.encoding import smart_unicode, smart_str
MIN_COMPRESS_LEN = 150000
class CacheClass(memcached.CacheClass):
def add(self, key, value, timeout=None, min_compress_len=MIN_COMPRESS_LEN):
if isinstance(value, unicode):

Upgrade Django from 1.1 to 1.5.1. This highlights some of the issues that one may encounter when updating Django. It's not possible to cover every case, but this should provide a good general starting point.

Change to DATABASES variable in settings.py.

Django now supports multiple databases and changes are needed to how the database connections are defined.

  • Changed in Django 1.2
  • Change Required by Django 1.4
  • Source: