Skip to content

Instantly share code, notes, and snippets.

View chmouel's full-sized avatar
🤨
Kuberneting

Chmouel Boudjnah chmouel

🤨
Kuberneting
View GitHub Profile
# test_server.py
import webob
from paste import httpserver
def app(environ, start_response):
request = webob.Request(environ)
print request
start_response("200 OK", [("Content-Type", "text/plain")])
for name,value in request.POST.items():
# test_client.py
import hmac
from time import time
from hashlib import sha1
import requests
MODE = "VM"
#!/bin/bash
TOKEN=56fa2267946c42dbbc4b6fbcb017650e
URL=https:/URL/STORAGE50GO
FILE=/tmp/monfichier.jpg
filename=$(basename ${FILE})
curl -H "X-Auth-Token: ${TOKEN}" ${URL}
# test_client.py
import hmac
from time import time
from hashlib import sha1
import requests
MODE = "VM"
# Proxy
NameVirtualHost *:8080
Listen 8080
<VirtualHost *:8080>
ServerName proxy-server
LimitRequestBody 5368709122
WSGIDaemonProcess proxy-server processes=5 threads=1
WSGIProcessGroup proxy-server
WSGIScriptAlias / /var/www/swift/proxy-server.wsgi
LimitRequestFields 200
@chmouel
chmouel / transfer-between-two-swifts.py
Last active December 14, 2015 16:48
Upload between two swifts without touching the local disks.
# -*- encoding: utf-8 -*-
__author__ = "Chmouel Boudjnah <[email protected]>"
from swiftclient import client as swiftclient
from swift.common.bufferedhttp import http_connect_raw
from swift.common.http import is_success
from swift.container.sync import _Iter2FileLikeObject
from eventlet import Timeout
import urllib2
GET_VM = 'vmm'
#!/bin/bash
ADMIN_ID=$(keystone user-list|sed -n '/ admin / { s/^..//;s/ .*//; p}')
RESELLER_ID=$(keystone role-list|sed -n '/ ResellerAdmin / { s/^..//;s/ .*//; p}')
TENANT_ID=$(keystone tenant-list|sed -n '/ admin / { s/^..//;s/ .*//; p}')
keystone user-role-add --user-id ${ADMIN_ID} --role-id ${RESELLER_ID} --tenant-id ${TENANT_ID}
[alias]
ghub = !sh -c 'git clone http://github.com/$1' -
@chmouel
chmouel / domain.py
Last active December 15, 2015 18:19
Get a token from keystone v3.
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
__author__ = "Chmouel Boudjnah <[email protected]>"
import os
import sys
import optparse
import json
import socket
import pprint
import urlparse
@chmouel
chmouel / botoconnect.py
Last active May 18, 2018 12:05
Connect to python swift boto.
#!/usr/bin/python
# Chmouel Boudjnah <[email protected]>
# source devstack/eucarc first
import boto
import sys
import boto.s3.connection
import boto.s3.key
import boto.exception
import StringIO
import os