Skip to content

Instantly share code, notes, and snippets.

View chmouel's full-sized avatar
☸️

Chmouel Boudjnah chmouel

☸️
View GitHub Profile
@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 <chmouel@chmouel.com>
#
# 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 / 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
#!/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 / openshift-v3-cleanup.sh
Last active August 29, 2015 14:17
OpenShift v3 cleanup resources
#!/bin/bash
for i in replicationController pod services route imagerepository buildconfig deploymentconfig service;do
for j in $(osc get $i|awk '{print $1}'|egrep -v '(POD|NAME|CONTROLLER)');do
osc delete $i $j
done
done
id: hello-openshift
kind: Pod
apiVersion: v1beta2
labels:
name: hello-openshift
desiredState:
manifest:
version: v1beta1
id: hello-openshift
#!/usr/bin/python
import json
import sys
import yaml
ydict = yaml.load(sys.stdin.read())
print(json.dumps(ydict))
#!/usr/bin/jython
import sys
from org.apache.commons.httpclient.protocol import Protocol
from com.vmware.vcloud.sdk import VcloudClient, Organization, Vdc
from com.vmware.vcloud.sdk.samples import FakeSSLSocketFactory
class VcloudLogin(object):
"""
Index: android/src/com/google/android/apps/chrometophone/C2DMReceiver.java
===================================================================
--- android/src/com/google/android/apps/chrometophone/C2DMReceiver.java (revision 11)
+++ android/src/com/google/android/apps/chrometophone/C2DMReceiver.java (working copy)
@@ -82,6 +82,16 @@
}
}
+ private String cyrketToMarket(String url) {
+ String ret = url.substring(32);
function kilo2pound () { printf "%.2f\n" $(( $1 * 2.20462262 )) }
function pound2kilo () { printf "%.2f\n" $(( $1 / 2.20462262 )) }
function meter2feet () { printf "%.2f\n" $(( $1 * 3.2808399 )) }
function feet2meter () { printf "%.2f feet\n" $(( $1 / 3.2808399 )) }
function kilometer2miles () { printf "%.2f miles\n" $(( $1 * 0.621371192 )) }
function miles2kilometers () { printf "%.2f km\n" $(( $1 / 0.621371192 )) }
function celsius2fareinheit () { printf "%.2f fareinheit\n" $(( ($1 * 9/5) + 32 )) }
function fareinheit2celsius () { printf "%.2f celsius\n" $(( ($1 - 32) * 5/9 )) }