Skip to content

Instantly share code, notes, and snippets.

View jd's full-sized avatar
🦾

Julien Danjou jd

🦾
View GitHub Profile
@jd
jd / filter.py
Created April 24, 2018 11:56
Filter with an AST
import operator
class InvalidFilter(Exception):
pass
class Filter(object):
binary_operators = {
u"=": operator.eq,
class A(object):
pass
class B(object):
__slots__ = ('foobar',)
def __init__(self):
self.x = 123
class C(A):
@jd
jd / mergify.yml
Created November 2, 2019 14:29
Mergify actions
conditions:
- branch=master
- "#approved-reviews-by>=2"
actions:
merge:
method: rebase
@jd
jd / ccijob.zsh
Last active March 5, 2020 13:54
Running a CircleCI job on your machine with config format 2.1
function ccijob
{
# Tempfile must be in the repository
local tmpfile="$(mktemp .circleci/config.processed.XXXXXX)"
circleci config process .circleci/config.yml > "$tmpfile"
if [ $? = 0 ]
then
circleci local execute --config "$tmpfile" --job "$1"
fi
rm "$tmpfile"
pull_request_rules:
# If a a pull request has this label, try to update it
- name: update on label
conditions:
- label=needs-update
actions:
update:
# If a PR is up-to-date, make sure it does not have the `needs-update` label
- name: clear update label