Skip to content

Instantly share code, notes, and snippets.

@parhammmm
parhammmm / models.py
Created December 8, 2012 19:20 — forked from treyhunner/models.py
Encrypt and decrypt Django model primary key values (useful for publicly viewable unique identifiers)
# This code is under the MIT license.
# Inspired by this StackOverflow question:
http://stackoverflow.com/questions/3295405/creating-django-objects-with-a-random-primary-key
import struct
from Crypto.Cipher import DES
from django.db import models
def base36encode(number):
"""Encode number to string of alphanumeric characters (0 to z). (Code taken from Wikipedia)."""
@UtahDave
UtahDave / saltsample_09252012_01
Created September 26, 2012 02:54 — forked from l2ol33rt/saltsample_09252012_01
Saltstack sample of using states and pillars for users
Here is a sample of how I am currently dealing with users.
Big thanks to uggedal! I used his user states as an example: https://github.com/uggedal/states
###
# How to create password hashes
###
python -c "import crypt; print crypt.crypt('password', '\$6\$SALTsalt\$')"
###
@pblittle
pblittle / config
Created March 22, 2012 17:45
Vagrant ssh config to ssh/scp from host
Host vagrant
HostName localhost
User vagrant
Port 2210
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
IdentityFile /Users/pblittle/.rvm/gems/ruby-1.9.2-p290@wilbur/gems/vagrant-0.9.7/keys/vagrant