Skip to content

Instantly share code, notes, and snippets.

View msimonin's full-sized avatar
💭
moving to gitlab

Matthieu Simonin msimonin

💭
moving to gitlab
View GitHub Profile
docker run --privileged -u ansible -v /etc/kolla//kolla-toolbox/:/var/lib/kolla/config_files/:ro -e KOLLA_SERVICE_NAME=kolla-toolbox -e ANSIBLE_LIBRARY=/usr/share/ansible -e ANSIBLE_NOCOLOR=1 -e KOLLA_CONFIG_STRATEGY=COPY_ALWAYS -e PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -e KOLLA_BASE_DISTRO=centos -e KOLLA_INSTALL_TYPE=source -e KOLLA_INSTALL_METATYPE=mixed -ti beyondtheclouds/centos-source-kolla-toolbox:5.0.1
INFO:__main__:Loading config file at /var/lib/kolla/config_files/config.json
INFO:__main__:Validating config file
INFO:__main__:Kolla config strategy set to: COPY_ALWAYS
INFO:__main__:Copying service configuration files
INFO:__main__:Writing out command to execute
Running command: 'sleep infinity'
# ip should be set on the br-ex bridge
ip addr del 192.168.143.127/32 dev eth2
ip addr add 192.168.143.127/32 dev br-ex
ifconfig br-ex up
route add -net 192.168.143.0/24 br-ex
(openvswitch-db)[root@paravance-3-kavlan-5 /]# ovs-vsctl show
de204f36-e5a5-4c79-b7be-15263abfe096
Manager "ptcp:6640:10.24.72.3"
Bridge br-ex
Controller "tcp:127.0.0.1:6633"
is_connected: true
fail_mode: secure
Port phy-br-ex
Interface phy-br-ex
type: patch
@msimonin
msimonin / netem
Last active April 10, 2017 14:51
# simple, only delay
IF=eth0
tc qdisc add dev $IF root netem delay 100ms
# complex with htb + delay + filtering
IF=eth0
tc qdisc del dev $IF root
tc qdisc add dev $IF root handle 1: htb
tc class add dev $IF parent 1: classid 1:10 htb rate 1mbit
tc qdisc add dev $IF parent 1:10 handle 10: netem delay 200ms
@msimonin
msimonin / ham_json.py
Created October 27, 2016 14:19
ham_json
#!/usr/bin/env python
DOCUMENTATION = '''
---
module: ham_json
short_description: Module for modifying json/yaml files
description:
- A module targeting at modifying json/yaml files
src:
description:
from sqlalchemy import create_engine
from sqlalchemy import Column, Integer, String, Table, Text, Date
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import ForeignKey
from sqlalchemy.orm import relationship, backref, sessionmaker, joinedload
from datetime import datetime
engine = create_engine('sqlite:///:memory:', echo=False)
Session = sessionmaker(bind=engine)
session = Session()
@msimonin
msimonin / commands
Last active December 29, 2023 07:09
install ubuntu on a virtual machine (libvirt / kvm)
# get the iso
wget http://releases.ubuntu.com/14.04.3/ubuntu-14.04.3-server-amd64.iso
# create the image disk
qemu-img create -f qcow2 disk.qcow2 10G
# launch the creation
virsh create ubuntu.xml
# you can connect to using vnc.
export DISPLAY=:1
Xvfb :1 -screen 0 1600x900x16 &
x11vnc -storepasswd "password" ~/.vnc_passwd
openbox-session &
x11vnc -scale 1 -display :1 -xkb -forever -rfbauth ~/.vnc_passwd &
# novnc support
# launch.sh --vnc localhost:5900
@msimonin
msimonin / kot.py
Last active August 29, 2015 14:26
king of tokyo
# -*- coding: utf-8 -*-
"""
6 dés, 3 relances.
Quelle est la probabilité d'obtenir au moins 3 faces identiques.
choix :
* on décide a priori d'essayer dobtenir au moins 3 dés avec une face prédéfinie (par exemple 1)
* on décide après le premier lancer d'obtenir au moins 3 dés avec une face qui a déjà été obtenue au premier lancer
"""
@msimonin
msimonin / dmtcp_event_resume
Created August 27, 2014 11:50
After checkpoint script
#!/usr/bin/env python
import boto
import boto.s3.connection
import sys
import os
access_key = 'ZO9OYE6J48X3LPP5JIWZ'
secret_key = 'QlyDGOBkjHa+AmKauCswrEs3kltF7XkiZCNVZG+Y'