Skip to content

Instantly share code, notes, and snippets.

➜ ~ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python -
Retrieving Poetry metadata
# Welcome to Poetry!
This will download and install the latest version of Poetry,
a dependency and package manager for Python.
It will add the `poetry` command to Poetry's bin directory, located at:
@mindlace
mindlace / keybase.md
Created October 7, 2015 21:44
My keybase proof

Keybase proof

I hereby claim:

  • I am mindlace on github.
  • I am mindlace (https://keybase.io/mindlace) on keybase.
  • I have a public key whose fingerprint is 6DAF 6728 0756 9B98 B0A9 00E8 65B9 DB02 7995 8354

To claim this, I am signing this object:

{ "instance_type":"big","region":"us-east","ami":"blah",
"builder": {
"instance_type": "small",
"web": {
"instance_type":"medium",
"ami": "blag"
}
}
}
@mindlace
mindlace / middleware.py
Created October 19, 2012 13:43
Add user created/modified to every model
"""Add user created_by and modified_by foreign key refs to any model automatically.
Almost entirely taken from https://github.com/Atomidata/django-audit-log/blob/master/audit_log/middleware.py"""
from django.db.models import signals
from django.utils.functional import curry
class WhodidMiddleware(object):
def process_request(self, request):
if not request.method in ('GET', 'HEAD', 'OPTIONS', 'TRACE'):
if hasattr(request, 'user') and request.user.is_authenticated():
user = request.user
@mindlace
mindlace / hell_router.py
Created October 16, 2012 15:31
Multi-DB madness.
import django.contrib.auth.signals.user_logged_in
import django.contrib.auth.signals.user_logged_out
from django.core.signals import request_finished
from django.dispatch import receiver
from django.conf import settings
import logging
class HellRouter(object):
"""
A router to control all database operations on models in the
@mindlace
mindlace / gist:1200597
Created September 7, 2011 13:43
Class that lets you edit key/value pair thingies
[System.Serializable]
public class PrefabsAndGhosts
{
public static string unnamedPrefabName = "New Prefab";
public bool ghostsExpanded = false;
public bool prefabsExpanded = false;
public const string UniqueIndicator = "-";
public PrefabRef newPrefab = new PrefabRef();
PrefabRef[] prefabs = new PrefabRef[] {};
List<PrefabRef> deleteEntries = new List<PrefabRef>();
@mindlace
mindlace / gist:1188090
Created September 2, 2011 07:17
working yield return
using UnityEngine;
using System.Collections;
public class YieldTest : MonoBehaviour {
public IEnumerator Do() {
print("Do now");
yield return new WaitForSeconds(2);
print("Do 2 seconds later");
}
public void Awake() {