Skip to content

Instantly share code, notes, and snippets.

@obeattie
obeattie / db_utils.py
Created October 14, 2009 12:51
Exposes SQLAlchemy's sessions and transactions as context managers (so they will be managed automatically inside blocks), and also provides a transaction decorator, which wraps an entire function in a transaction
"""Utilities for managing database sessions."""
from __future__ import with_statement
import contextlib
import functools
@contextlib.contextmanager
def temp_session(session_cls, **kwargs):
"""Quick and dirty context manager that provides a temporary Session object
to the nested block. The session is always closed at the end of the block.
@jjdelc
jjdelc / list_filter_collapse.js
Created May 22, 2011 08:56
Collapse list_filter in Django admin
;(function($){
ListFilterCollapsePrototype = {
bindToggle: function(){
var that = this;
this.$filterEl.click(function(){
that.$filterList.slideToggle();
});
},
init: function(filterEl) {
this.$filterEl = $(filterEl).css('cursor', 'pointer');
@wolever
wolever / wifi_and_power.rst
Created November 8, 2011 02:57
Wifi and power for medium sized tech events

This document is a practical checklist for anyone who needs to provide wifi and power for medium sized (10-100 attendants) tech events where attendees will expect to be able to plug in their laptops and get on a wireless network.

Full disclosure: I'm not an expert at this, but hopefully the things I've learned will be better than nothing.

General Notes

# Compliments to Nick Coghlan for coming up with this sort of scheme
# foo 1.2 is not installed, this command would download, and "install"
# it into ~/.pip/dists/foo-1.2/ and then link $VENV/site-packages/foo -> ~/.pip/dists/foo-1.2/
$ pip install foo==1.2
# In another virtualenv this command would see that ~/.pip/dists/foo-1.2/ already
# exists so instead of downloading + installing it, it simply links $OTHER_VENV/site-packages/foo/
# to ~/.pip/dists/foo-1.2/
$ pip install foo=1.2
@lahwran
lahwran / programmingresources.md
Last active November 19, 2018 19:46
Programming learning resources

This list was originally authored by a friend who has been learning programming for some time (tuningmind)

Programming learning resources

Note: Many books may be available from a nearby public library. Check there as well!

These two are about the best I've seen for starting from scratch:

@namuol
namuol / INSTALL.md
Last active December 11, 2024 12:21
rage-quit support for bash

rage-quit support for bash

HOW TO INSTALL

Put flip somewhere in your $PATH and chmod a+x it.

Copy fuck into ~/.bashrc.

During the PyLadies lunch here at PyCon, I heard 5 people stand up and say that they would not have given a talk if an individual (in many cases Jessica McKellar) hadn't pestered them repeatedly to give a talk. I saw later that someone else had heard this from 10+ people at the lunch.

Increasing speaker diversity is both about sending emails "to the right mailing lists" but it is also largely dependent on individuals reaching out to new (and veteran) speakers to get them to submit talks.

So - a lot of this work has to happen on multiple fronts at the same time - the CFPs need to go out to lots of lists, and individuals need to reach out to lots of individuals.

The only way I have seen this be consistently successful is if many people on the conference committee are all making individual requests to speakers, and the people making the requests are trusted by the talk submitters. It's a systemic issue involving visibility, trust, mentorship in general, talk submission mentoring, and mentorship of talk c

@dergachev
dergachev / SPIN-selling.md
Last active July 17, 2022 03:03
SPIN Selling seminar
@pior
pior / pyramid_main.py
Last active April 12, 2017 15:37
Keep your deployment secrets out of your PasterDeploy configuration using Environment Variables
import os
from pyramid.config import Configurator
def main(global_config, **settings):
settings = {k: os.path.expandvars(v) for k, v in settings.items()}
config = Configurator(settings=settings)
config.include(__name__)
return config.make_wsgi_app()