import collections
import itertools
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
usage() { | |
cat <<EOF | |
usage: git gone [-pldD] [<branch>=origin] | |
OPTIONS | |
-p prune remote branch | |
-n dry run: list the gone branches | |
-d delete the gone branches | |
-D delete the gone branches forcefully |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Sometimes in your Django model you want to raise a ``ValidationError`` in the ``save`` method, for | |
some reason. | |
This exception is not managed by Django Rest Framework because it occurs after its validation | |
process. So at the end, you'll have a 500. | |
Correcting this is as simple as overriding the exception handler, by converting the Django | |
``ValidationError`` to a DRF one. | |
""" | |
from django.core.exceptions import ValidationError as DjangoValidationError |
If anyone is interested in setting up their system to automatically (or manually) sign their git commits with their GPG key, here are the steps:
- Generate and add your key to GitHub
$ git config --global commit.gpgsign true
([OPTIONAL] every commit will now be signed)$ git config --global user.signingkey ABCDEF01
(whereABCDEF01
is the fingerprint of the key to use)$ git config --global alias.logs "log --show-signature"
(now available as$ git logs
)$ git config --global alias.cis "commit -S"
(optional if global signing is false)$ echo "Some content" >> example.txt
$ git add example.txt
$ git cis -m "This commit is signed by a GPG key."
(regularcommit
will work if global signing is enabled)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pip install readme-renderer && python setup.py check -rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# note que ça peut être /etc/NetworkManager/dnsmasq.d/custom pour utiliser NetworkManager comme aiguilleur. | |
bind-interfaces | |
except-interface=docker0 | |
except-interface=virbr* | |
except-interface=lxcbr* | |
log-queries | |
dns-forward-max=5 | |
# 1h de TTL de base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Jinja2Backend(jinja2backend.Jinja2): | |
def __init__(self, params): | |
self.context_processors = [ | |
import_string(p) | |
for p in params['OPTIONS'].pop('context_processors', []) | |
] | |
super(Jinja2Backend, self).__init__(params) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Luxafor via Python | |
# Dave Irvine www.daveirvine.me @dave_irvine | |
# Get PyUSB from: | |
# http://walac.github.io/pyusb/ | |
#!/usr/bin/python | |
import usb.core | |
import usb.util |
Source: article from The Guardian
from itertools import permutations
NewerOlder