Skip to content

Instantly share code, notes, and snippets.

View sutyrin's full-sized avatar

Pavel Sutyrin sutyrin

View GitHub Profile
@umbrellaprocess
umbrellaprocess / gist:973d2aa16e95bf329ee2
Last active December 16, 2021 08:53
A simple example of MIDI Keyboard for SuperCollider 3.6.x
/**
* A simple example of MIDI Keyboard for SuperCollider 3.6.x
*/
MIDIIn.connect;
s.boot;
(
SynthDef("umbSinewave",{
arg freq=440, gate=1, amp=1, pan=0;
@telent
telent / gist:9742059
Last active February 19, 2024 09:30
12 factor app configuration vs leaking environment variables
App configuration in environment variables: for and against
For (some of these as per the 12 factor principles)
1) they are are easy to change between deploys without changing any code
2) unlike config files, there is little chance of them being checked
into the code repo accidentally
3) unlike custom config files, or other config mechanisms such as Java
@datamafia
datamafia / BulkInsertManager.py
Created March 20, 2014 19:26
Django Bulk Insert Manager for ON DUPLICATE IGNORE and ON DUPLICATE KEY in MySQL
#!/usr/bin/env python
# marc-w.com
# Built and tested on Django 1.5
class BulkInsertManager(models.Manager):
def _bulk_insert_ignore(self, create_fields, values, print_sql=False):
'''
Bulk insert/ignore
@param create_fields : list, required, fields for the insert field declaration
@inklesspen
inklesspen / README.md
Last active September 6, 2023 17:11
Fast and flexible unit tests with live Postgres databases and fixtures

(This gist is pretty old; I've written up my current approach to the Pyramid integration on this blog post, but that blog post doesn't go into the transactional management, so you may still find this useful.)

Fast and flexible unit tests with live Postgres databases and fixtures

I've created a Pyramid scaffold which integrates Alembic, a migration tool, with the standard SQLAlchemy scaffold. (It also configures the Mako template system, because I prefer Mako.)

I am also using PostgreSQL for my database. PostgreSQL supports nested transactions. This means I can setup the tables at the beginning of the test session, then start a transaction before each test happens and roll it back after the test; in turn, this means my tests operate in the same environment I expect to use in production, but they are also fast.

I based my approach on [sontek's blog post](http://sontek.net/blog/

@codysoyland
codysoyland / virtualenv-auto-activate.sh
Created March 25, 2012 18:34
virtualenv-auto-activate
#!/bin/bash
# virtualenv-auto-activate.sh
#
# Installation:
# Add this line to your .bashrc or .bash-profile:
#
# source /path/to/virtualenv-auto-activate.sh
#
# Go to your project folder, run "virtualenv .venv", so your project folder
# has a .venv folder at the top level, next to your version control directory.