Skip to content

Instantly share code, notes, and snippets.

View bergantine's full-sized avatar

J*Bergantine bergantine

  • London, United Kingdom
View GitHub Profile
@bergantine
bergantine / pprint_list.py
Last active August 29, 2015 14:06
#python #pprint a #list
import pprint
mylist = [ ... ]
with open('mylist_saved_to_a_file.py', 'w') as f:
pprint.pprint(mylist, f)
@bergantine
bergantine / execute via
Created April 17, 2014 17:14
Single-file Django site
$ python project_name.py runserver
@bergantine
bergantine / genpass.py
Last active May 18, 2021 07:13
Safari-style #python #password Generator
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 March 2, 2014 14:39
__init__.py file for a #Django #tests directory to run any or each #test in that #directory (for Django < 1.6)
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 August 29, 2015 13:56
package.json for Grunt-cli
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 November 18, 2021 12:11
Vagrant config for Apache + mod_ssi
@bergantine
bergantine / Vagrantfile
Last active August 29, 2015 13:56
Modifying django-newproj to use with Zurb Foundation
# -*- 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 July 13, 2022 04:15
Vagrant box for Zurb development.
# -*- 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 August 30, 2022 19:31
Vagrant config for basic Python development
# -*- 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 August 29, 2015 13:55
Vagrant config for a new Ruby on Rails project