Skip to content

Instantly share code, notes, and snippets.

View 4383's full-sized avatar
🏠
Working from home

Hervé Beraud 4383

🏠
Working from home
View GitHub Profile
@4383
4383 / locate file rpm
Created September 26, 2019 13:12
locate where file is installed through rpm info
$ rpm -ql openstack-tripleo-heat-templates | grep logrot
@4383
4383 / trace.sh
Created September 24, 2019 16:16
trace python script
python -m trace --trace script.py # affiche l'exécution d'un programme ligne par ligne
@4383
4383 / drop.sh
Last active September 12, 2019 15:36
Drop rabbitmq trafic
sudo iptables -I 1 INPUT -p tcp --sport 5672 --j DROP # source
sudo iptables -I 1 INPUT -p tcp --dport 5672 --j DROP # destination
<wait for heartbeat failures>
sudo iptables -D INPUT 1
sudo rabbitmqctl -p test list_queues name messages messages_unacknowledged | grep reply
reply_f4b9a59c84b04857ae8ed992c618eaba 0 0
reply_bef3bbc2619247b0b287d19bfd685de3 0 0
reply_e6151828c288457e9cc01e5e6167e4e3 0 0
@4383
4383 / retrieve.sh
Last active July 1, 2019 14:11
retrieve oslo projects from governance by using niet
# retrieve all the oslo projects url by using openstack/governance
# https://github.com/openstack/governance
# first install niet
# pip install niet
niet "oslo.deliverables.*[repos][0]" governance/reference/projects.yaml
niet "oslo.deliverables.*[repos][0][0]" governance/reference/projects.yaml -f ifs
# openstack/automaton openstack/castellan openstack/cookiecutter openstack/debtcollector openstack/devstack-plugin-amqp1 openstack/devstack-plugin-kafka openstack/devstack-plugin-pika openstack/devstack-plugin-zmq openstack/futurist openstack/mox3 openstack/oslo-cookiecutter openstack/oslo-specs openstack/oslo.cache openstack/oslo.concurrency openstack/oslo.config openstack/oslo.context openstack/oslo.db openstack/oslo.i18n openstack/oslo.limit openstack/oslo.log openstack/oslo.messaging openstack/oslo.middleware openstack/oslo.policy openstack/oslo.privsep openstack/oslo.reports openstack/oslo.rootwrap openstack/oslo.serialization openstack/oslo.service openstack/oslo.tools openstack/oslo.upgradecheck openstac
@4383
4383 / fast8.sh
Created June 21, 2019 08:06 — forked from zaneb/fast8.sh
Run flake8 against only files that have changed
#!/bin/bash
set -e
enable_env() {
local env_name="$1"
local env_dir=".tox/${env_name}"
if [ ! -d "${env_dir}" ]; then
if [ ! -f tox.ini ]; then
echo 'No tox.ini found' >&2
@4383
4383 / oslo-service-reproducer.py
Created June 20, 2019 15:35
oslo-service-reproducer
#!/usr/bin/env python
#
import logging
from oslo_service import service
from oslo_config import cfg
import pdb
import traceback
import os
import time
@4383
4383 / eventlet_threading.py
Last active June 4, 2019 17:04
always use pthread on monkey patched environment
import eventlet
eventlet.monkey_patch()
if eventlet.patcher.is_monkey_patched("thread"):
print("Patched")
threading = eventlet.patcher.original("threading")
else:
print("Not Patched")
import threading
@4383
4383 / eventlet_threading.py
Created June 4, 2019 16:57
verify that the threading module come from the stdlib
import eventlet
import threading
eventlet.monkey_patch()
print(threading.current_thread.__module__)
# Will print "eventlet.green.threading"
assert threading.current_thread.__module__ == 'threading'
# Will raise the following assertion error:
# Traceback (most recent call last):
@4383
4383 / test.py
Created May 17, 2019 14:11 — forked from zzzeek/test.py
Python getargspec, getfullargspec, Signature performance comparison
# So interestingly, Signature seems to be twice as fast in Python 3.6 and 3.7 as it
# was in Python 3.3 and 3.4. However, it is still 6-18 times slower than the old
# getargspec or getfullargspec that was in Python 3.3.
Python 2.7 getargspec (doesn't use Signature) : specimen_one (6 args) : 0.0503
Python 2.7 getargspec (doesn't use Signature) : specimen_two (0 args) : 0.0496
Python 2.7 getargspec (doesn't use Signature) : specimen_three (6 args) : 0.0500
Python 2.7 getargspec (doesn't use Signature) : specimen_four (13 args) : 0.0652
Python 3.3 getfullargspec (doesn't use Signature) : specimen_one (6 args) : 0.0539
@4383
4383 / openstack-oslo-projects.yaml
Last active May 16, 2019 16:39
Openstack oslo projects - yaml format to automatize things
projects:
automaton:
Summary: a framework for building state machines.
Proposal: https://review.openstack.org/#/c/141961/
Source: http://git.openstack.org/cgit/openstack/automaton
Bugs: https://bugs.launchpad.net/automaton
Core: https://review.openstack.org/#/admin/groups/106,members
Documentation: http://docs.openstack.org/developer/automaton/
Github: https://github.com/openstack/automaton
castellan: