Skip to content

Instantly share code, notes, and snippets.

View chmouel's full-sized avatar
🤨
Kuberneting

Chmouel Boudjnah chmouel

🤨
Kuberneting
View GitHub Profile
@chmouel
chmouel / docker-hot-template.yaml
Last active January 4, 2022 22:50
A heat template that use docker to create containers for a wordpress install. You need to configure the plugin first in /etc/heat/heat.conf (see the README) and pull the images (i.e: docker pull samalba/wordpress samalba/mysql)
heat_template_version: 2013-05-23
description: >
Docker example template, you need to docker pull samalba/wordpress and samalba/mysql first.
resources:
wordpress:
type: DockerInc::Docker::Container
properties:
image: samalba/wordpress
@chmouel
chmouel / spec-convert.py
Last active August 29, 2015 14:05
Take a openstack spec review and convert the rst in HTML (default) or PDF
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Chmouel Boudjnah <[email protected]>
#
# 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
#
@chmouel
chmouel / znc-add-user.sh
Last active May 3, 2016 14:25
Script to add user, to copy and paste in your irc buffer to create the user as admin and send the other part to the user for infos
#!/bin/bash
USER=$1
REALNAME=$2
PASS=$(pwgen -B -s -n 12 1)
if [[ -z ${USER} || -z ${REALNAME} ]];then
echo "znc-add-user.sh: login realname"
exit 1
fi
@chmouel
chmouel / pan.zsh
Last active June 4, 2017 10:16
PAN: a zsh tool to switch easily with completion the tox virtualenvs and tests (demo: http://i.imgur.com/kJsJTjj.gif)
# Author: Chmouel Bodujnah <[email protected]>
#
# Pan a zsh tool to complete virtualenv tox targets and tests launched via
# testtools
#
# Demo: http://i.imgur.com/kJsJTjj.gif
#
# When you use zsh just source the file directly and when you are inside a
# project which has been pre-built with tox targets you can start do:
# pan <TAB>
function check_up() {
service=$1
host=$2
port=$3
max=13 # 1 minute
counter=1
while true;do
python -c "import socket;s = socket.socket(socket.AF_INET, socket.SOCK_STREAM);s.connect(('$host', $port))" \
@chmouel
chmouel / novadocker-play.org
Last active August 29, 2015 14:11
Nova+Docker playbook

Setup VM

I am using my own scripts from http://github.com/chmouel/rise-mystack but you can obv just pre-setup your vm the way you want. I am using Fedora20 (but 21 should work as well)*

./rise.sh ssh vm

Preconfigure nova-docker

mkdir -p /opt/stack cd /opt/stack

@chmouel
chmouel / rpm-build.sh
Created December 31, 2014 11:05
rpm-build.sh
#!/bin/bash
set -exf
PROJECT=myproject
CURDIR=$(dirname $(readlink -f $0))
TOPDIR=$(git rev-parse --show-topklevel 2>/dev/null)
rm -rf ${CURDIR}/.build/rpm
mkdir -p ${CURDIR}/.build/rpm/{BUILD,SRPMS,SPECS,RPMS/noarch}
cp -r ${CURDIR}/SOURCES ${CURDIR}/.build/rpm
@chmouel
chmouel / Dockerfile-rpm
Created December 31, 2014 11:07
Dockerfile for rpm building with rdo
FROM fedora:21
MAINTAINER Chmouel Boudjnah <[email protected]>
RUN yum -y groupinstall 'Development Tools'
RUN yum -y install fedora-packager
RUN yum -y install yum-utils
RUN yum -y install sudo
RUN sed -i.bak -n -e '/^Defaults.*requiretty/ { s/^/# /;};/^%wheel.*ALL$/ { s/^/# / ;} ;/^#.*wheel.*NOPASSWD/ { s/^#[ ]*//;};p' /etc/sudoers
#!/bin/bash
# script run inside the container
rpmbuild -ba rpmbuild/SPECS/project.spec || exit 1
[[ -d /data ]] || exit 0
sudo rm -rf /data/output
sudo cp -a rpmbuild/RPMS/noarch /data/output
@chmouel
chmouel / oslo.cfg-etcd.bash
Last active July 4, 2017 09:20
Oslo cfg backed by etcd example
### The script which access oslo.cfg and print a value
chmouel@TheBatman:GIT/openstack/oslo.config$ cat ~/tmp/c.py [etcd]
import sys
from oslo.config import cfg
opt_group = cfg.OptGroup(name='simple', title='A Simple Example')
simple_opts = [