This file contains hidden or 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
# -*- 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 | |
# |
This file contains hidden or 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
def count_lead_and_trail_zeroes(d): | |
"""Count the number of leading and trailing zeroes in an integer.""" | |
b = "{:064b}".format(d) | |
try: | |
return as_str.index("1"), 63 - as_str.rindex("1") | |
except ValueError: | |
return 64, 64 | |
def count_lead_and_trail_zeroes(d): | |
# https://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightLinear |
This file contains hidden or 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
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 |
This file contains hidden or 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
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" |
This file contains hidden or 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
conditions: | |
- branch=master | |
- "#approved-reviews-by>=2" | |
actions: | |
merge: | |
method: rebase |
This file contains hidden or 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 A(object): | |
pass | |
class B(object): | |
__slots__ = ('foobar',) | |
def __init__(self): | |
self.x = 123 | |
class C(A): |
This file contains hidden or 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
import operator | |
class InvalidFilter(Exception): | |
pass | |
class Filter(object): | |
binary_operators = { | |
u"=": operator.eq, |
This file contains hidden or 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
# -*- encoding: utf-8 -*- | |
import cProfile | |
import random | |
import uuid | |
import daiquiri | |
import numpy | |
from gnocchi.cli import metricd | |
from gnocchi import incoming |
This file contains hidden or 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
#!/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"), |
This file contains hidden or 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
!/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() |
NewerOlder