Skip to content

Instantly share code, notes, and snippets.

@bergantine
bergantine / pprint_list.py
Last active Aug 29, 2015
#python #pprint a #list
View pprint_list.py
import pprint
mylist = [ ... ]
with open('mylist_saved_to_a_file.py', 'w') as f:
pprint.pprint(mylist, f)
@bergantine
bergantine / execute via
Created Apr 17, 2014
Single-file Django site
View execute via
$ python project_name.py runserver
@bergantine
bergantine / genpass.py
Last active May 18, 2021
Safari-style #python #password Generator
View genpass.py
from random import choice
def genCode(len):
return ''.join([choice('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789') for i in range(len)])
print '%s-%s-%s-%s' % (genCode(3), genCode(3), genCode(3), genCode(3))
@bergantine
bergantine / __init__.py
Created Mar 2, 2014
__init__.py file for a #Django #tests directory to run any or each #test in that #directory (for Django < 1.6)
View __init__.py
import pkgutil
import unittest
for loader, module_name, is_pkg in pkgutil.walk_packages(__path__):
module = loader.find_module(module_name).load_module(module_name)
for name in dir(module):
obj = getattr(module, name)
if isinstance(obj, type) and issubclass(obj, unittest.case.TestCase):
exec ('%s = obj' % obj.__name__)
@bergantine
bergantine / Gruntfile.js
Last active Aug 29, 2015
package.json for Grunt-cli
View Gruntfile.js
module.exports = function(grunt) {
grunt.registerTask('watch', [ 'watch' ]);
grunt.initConfig({
less: {
style: {
files: {
"css/screen.css": "less/screen.less"
}
@bergantine
bergantine / Readme.md
Last active Nov 18, 2021
Vagrant config for Apache + mod_ssi
View Readme.md
@bergantine
bergantine / Vagrantfile
Last active Aug 29, 2015
Modifying django-newproj to use with Zurb Foundation
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise64"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
@bergantine
bergantine / Vagrantfile
Last active Jun 26, 2017
Vagrant box for Zurb development.
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise64-2"
# The url from where the 'config.vm.box' box will be fetched if it
@bergantine
bergantine / Vagrantfile
Last active Aug 17, 2021
Vagrant config for basic Python development
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise64"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
@bergantine
bergantine / Readme.md
Last active Aug 29, 2015
Vagrant config for a new Ruby on Rails project
View Readme.md