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 / 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 / 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 / trigger-zuul-periodic-job.sh
Created May 15, 2019 12:16 — forked from mgagne/trigger-zuul-periodic-job.sh
Trigger a Zuul periodic job
./tools/trigger-job.py --job periodic-foobar-proposal --project dev/foobar --pipeline periodic --url https://zuul.example.org/p --logpath /dev/null --newrev refs/heads/master --refname refs/heads/master
@4383
4383 / docker_vs_podman_run.sh
Created February 1, 2019 10:54 — forked from bogdando/docker_vs_podman_run.sh
Comparing the time it takes to launch containers concurrently for docker and podman runtimes
#!/bin/bash
set -e
containers_total=${1:-100}
containers_concur=${2:-10}
container_image=${3:-docker.io/library/busybox}
podman pull $container_image
docker pull $container_image
rm -f bench-jobs.txt
export OS_PROJECT_DOMAIN_NAME='Default'
export OS_USER_DOMAIN_NAME='Default'
export OS_PROJECT_NAME='admin'
export OS_USERNAME='admin'
export OS_AUTH_URL=http://192.168.24.2:5000/
export OS_AUTH_TYPE='password'
export OS_IDENTITY_API_VERSION='3'
export OS_PASSWORD=$(hiera -c /etc/puppet/hiera.yaml keystone::admin_password)
@4383
4383 / irc.md
Created September 17, 2018 07:55 — forked from xero/irc.md
irc cheat sheet

#IRC Reference

Not intended as a guide for newbies, more like a "cheat sheet" for the somewhat experienced IRC user, especially one who wields some power over a channel.

##The Basics

  • /join #channel
    • Joins the specified channel.
  • /part #channel
    • Leaves the specified channel.
'''This script goes along the blog post
"Building powerful image classification models using very little data"
from blog.keras.io.
It uses data that can be downloaded at:
https://www.kaggle.com/c/dogs-vs-cats/data
In our setup, we:
- created a data/ folder
- created train/ and validation/ subfolders inside data/
- created cats/ and dogs/ subfolders inside train/ and validation/
- put the cat pictures index 0-999 in data/train/cats
@4383
4383 / README-Template.md
Created May 2, 2018 13:54 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@4383
4383 / enumerate_interfaces.py
Last active June 26, 2018 12:25 — forked from pklaus/enumerate_interfaces.py
Python: List all Network Interfaces On Computer
# Use those functions to enumerate all interfaces available on the system using Python.
# found on <http://code.activestate.com/recipes/439093/#c1>
import socket
import fcntl
import struct
import array
def all_interfaces():
max_possible = 128 # arbitrary. raise if needed.