Skip to content

Instantly share code, notes, and snippets.

View jd's full-sized avatar
🦾

Julien Danjou jd

🦾
View GitHub Profile
# -*- encoding: utf-8 -*-
#
# Copyright © 2016 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
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
@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"
@jd
jd / mergify.yml
Created November 2, 2019 14:29
Mergify actions
conditions:
- branch=master
- "#approved-reviews-by>=2"
actions:
merge:
method: rebase
class A(object):
pass
class B(object):
__slots__ = ('foobar',)
def __init__(self):
self.x = 123
class C(A):
@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,
@jd
jd / micro-metricd.py
Created February 8, 2018 15:40
Gnocchi profiling tool
# -*- encoding: utf-8 -*-
import cProfile
import random
import uuid
import daiquiri
import numpy
from gnocchi.cli import metricd
from gnocchi import incoming
@jd
jd / gnocchi-metric-delete.py
Last active July 21, 2017 16:12
Deleting Gnocchi metric with Keystone auth
#!/usr/bin/env python
import os
from concurrent.futures import thread
from gnocchiclient import client
from keystoneauth1 import identity
from keystoneauth1 import session
auth = identity.Password(auth_url=os.getenv("OS_AUTH_URL"),
@jd
jd / auto-star-openstack-repo
Created August 19, 2014 14:48
Starring all OpenStack Git repositories
!/usr/bin/env python
from github import Github
USERNAME = "myusername"
PASSWORD = "mypassword"
USERS = ("openstack", "stackforge", "openstack-dev", "openstack-infra")
g = Github(USERNAME, PASSWORD)
me = g.get_user()
@jd
jd / emacs-revert-9344612d3cd164317170b6189ec43175757e4231.diff
Last active June 20, 2017 09:20
Revert commit 9344612d3cd164317170b6189ec43175757e4231 of Emacs
--- emacs/src/macfont.m.orig 2017-06-20 11:18:58.000000000 +0200
+++ emacs/src/macfont.m 2017-06-20 11:19:26.000000000 +0200
@@ -2373,9 +2373,9 @@
!= (spacing >= FONT_SPACING_MONO)))
continue;
- /* Don't use a color bitmap font until it is supported on
- free platforms. */
- if (sym_traits & kCTFontTraitColorGlyphs)
+ /* Don't use a color bitmap font unless its family is