Skip to content

Instantly share code, notes, and snippets.

Julien Danjou jd

Block or report user

Report or block jd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View slots-are-fun.py
class A(object):
pass
class B(object):
__slots__ = ('foobar',)
def __init__(self):
self.x = 123
class C(A):
@jd
jd / filter.py
Created Apr 24, 2018
Filter with an AST
View filter.py
import operator
class InvalidFilter(Exception):
pass
class Filter(object):
binary_operators = {
u"=": operator.eq,
View gorilla-xor-encoding.py
# -*- 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
#
@jd
jd / micro-metricd.py
Created Feb 8, 2018
Gnocchi profiling tool
View micro-metricd.py
# -*- 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 Jul 21, 2017
Deleting Gnocchi metric with Keystone auth
View gnocchi-metric-delete.py
#!/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 Aug 19, 2014
Starring all OpenStack Git repositories
View auto-star-openstack-repo
!/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 Jun 20, 2017
Revert commit 9344612d3cd164317170b6189ec43175757e4231 of Emacs
View emacs-revert-9344612d3cd164317170b6189ec43175757e4231.diff
--- 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
View ceph-fill-omap.py
import cradox as rados
POOL_NAME = "gnocchi-test"
CONFFILE = ""
USERNAME = ""
OBJECT_NAME = "myomapobject"
ITER = 100
# options['keyring'] = conf.ceph_keyring
# options['key'] = conf.ceph_secret
@jd
jd / gist:6c53a9877cad50352fff31aecbd29410
Last active Jun 10, 2016
Gnocchi + Aodh alarm triggering test
View gist:6c53a9877cad50352fff31aecbd29410
➔ gnocchi metric create -a high
+------------------------------------+-------------------------------------------------------------------+
| Field | Value |
+------------------------------------+-------------------------------------------------------------------+
| archive_policy/aggregation_methods | std, count, 95pct, min, max, sum, median, mean |
| archive_policy/back_window | 0 |
| archive_policy/definition | - points: 3600, granularity: 0:00:01, timespan: 1:00:00 |
| | - points: 10080, granularity: 0:01:00, timespan: 7 days, 0:00:00 |
| | - points: 8760, granularity: 1:00:00, timespan: 365 days, 0:00:00 |
| archive_policy/name | high |
@jd
jd / handson.py
Last active Apr 25, 2016
Hands-on Gnocchi + CK @ OpenStack Summit Newton
View handson.py
#!/usr/bin/env python
import uuid
import logging
import os
import random
import sys
from keystoneauth1.identity import v3
from keystoneauth1 import session
from keystoneclient.v3 import client as ks
You can’t perform that action at this time.