I hereby claim:
- I am benjaoming on github.
- I am benjaoming (https://keybase.io/benjaoming) on keybase.
- I have a public key ASCa077dJpvd_GlrDxPvWAQUkdoRhqhU_mHh9eg1zSQxWgo
To claim this, I am signing this object:
#!/bin/bash | |
# Fixes a downloaded apt mirror | |
# See: https://github.com/apt-mirror/apt-mirror/issues/113#issuecomment-464932493 | |
## first parameter is optional mirror list file | |
if [ "$1" != "" ] | |
then | |
mirrorlist=$1 | |
else |
#!/usr/bin/env python3 | |
import random | |
nouns = [ | |
"sten", | |
"et glashus", | |
"perler", | |
"svin", | |
"hunden", |
""" | |
Ever got tired of having loads of migrations that have no effect on | |
the actual database? | |
This little mockup presents how we can move properties of fields into | |
a scope where they can easily be ignored by the migration system | |
Would it work? | |
""" | |
from django.db import models |
#!/usr/bin/python3 | |
# | |
# If you are using Thunderbird and other todo clients that do not support | |
# creation of new calendars on a CalDav backend (such as Fastmail), you'll | |
# need to tell Fastmail directly via CalDav. | |
# | |
# Dependencies: On Debian/Ubuntu, install python3-caldav: | |
# | |
# sudo apt install python3-caldav | |
# |
#!/usr/bin/python3 | |
""" | |
This script adds on_delete to Django migrations. It works on multi-line | |
definitions of ForeignKey/OneToOneField which may be in your codebase if you | |
have black'ened the migration files. | |
It's not perfect, but it doesn't create syntax errors and you can run black on | |
the code again afterwards. | |
First version: |
# -*- coding: utf-8 -*- | |
"""Refactor South migrations to use settings.AUTH_USER_MODEL. | |
Inserts a backwards-compatible code-snippet in all | |
your schema migration files and uses a possibly customized user | |
model as introduced in Django 1.5. | |
Please note that this has nothing to do with changing | |
settings.AUTH_USER_MODEL to a new model. If you do this, stuff | |
will very likely break in reusable apps that have their own | |
migration trees. |
""" | |
Automatically suspend computer when the user has fallen asleep. But using your | |
own custom timing. | |
Add to your crontab with `crontab -e` | |
# m h dom mon dow command | |
0 2 * * * python3 /path/to/awake_or_suspend.py | |
This command either needs that your user can invoke `sudo` without a password or that it's launched with sude permissions. |
class ExceptionUserInfoMiddleware(object): | |
""" | |
Adds user details to request context on receiving an exception, so that they show up in the error emails. | |
Add to settings.MIDDLEWARE_CLASSES and keep it outermost(i.e. on top if possible). This allows | |
it to catch exceptions in other middlewares as well. | |
Origin: https://gist.github.com/646372 | |
""" | |
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/env bash | |
# get the upstream repository username | |
upstream_repo=$(git config remote.upstream.url | sed 's/^.*://' | sed 's/\/.*$//') | |
# open the PR against develop, or another branch specified as the first command-line argument | |
upstream_branch=${1:-develop} | |
# branch | |
branch=$(git symbolic-ref HEAD | sed 's/refs\/heads\///') |