Skip to content

Instantly share code, notes, and snippets.

View chmouel's full-sized avatar
☸️

Chmouel Boudjnah chmouel

☸️
View GitHub Profile
#!/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 )) }
@chmouel
chmouel / upload-to-rackspace-cloud-file.sh
Created June 9, 2010 18:53
Upload to RackSpace CloudFiles from shell with curl.
#!/bin/bash
# Author: Chmouel Boudjnah <chmouel.boudjnah@rackspace.co.uk>
# Not officially supported by Rackspace only as a best effort basis :)
# Define yes to make it to copy to url to clipboard (via a shortened url
# service) You need to have the software xclip installed in your system.
COPY_URL_TO_CLIPBOARD=yes
# Containers to ignore in the list
CONTAINERS_TO_IGNORE=".CDN_ACCESS_LOGS"
#!/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):
"""
VcloudLogin: Login to vcloud class
class IllegalDecoratorArgument(Exception):
pass
class IllegalPassedType(Exception):
pass
def check_arg(*fargs):
def decorator(target):
def wrapper(*args, **kwargs):
if len(fargs) != len(args):
diff -uw -L /rsyncc:chmouel@acer:/home/chmouel/.xbmc/addons/script.tv.show.next.aired/resources/lib/scraper.py.order-by -L /rsyncc:chmouel@acer:/home/chmouel/.xbmc/addons/script.tv.show.next.aired/resources/lib/scraper.py /tmp/tramp.10818XFG.order-by /tmp/tramp.10818kPM.py
--- script.tv.show.next.aired/resources/lib/scraper.py~
+++ script.tv.show.next.aired/resources/lib/scraper.py
@@ -9,10 +9,12 @@
import xbmc
import xbmcgui
import time
+import datetime
SOURCEPATH = os.getcwd()
@chmouel
chmouel / create-cs-and-customize.py
Created November 23, 2010 12:35
Create Cloud Servers via API and customize it via SSH
#!/usr/bin/python
# -*- encoding: utf-8 -*-
#
# Chmouel Boudjnah <chmouel@chmouel.com>
import os
import cloudservers
from subprocess import call
API_USER=""
API_KEY=""
@chmouel
chmouel / cf-transfer-between-accounts.py
Created December 6, 2010 17:38
Transfer between cloud files account (via spooling localy on disks)
#!/usr/bin/python
# -*- encoding: utf-8 -*-
__author__ = "Chmouel Boudjnah <chmouel@chmouel.com>"
import cloudfiles
import tempfile
import os
FROM_AUTH_USER=""
FROM_AUTH_API_KEY=""
FROM_CONTAINER=""
@chmouel
chmouel / openstack-upload-to-swift-and-glance.py
Created December 7, 2010 16:20
Upload images to swift and insert it in glance DB
__author__ = "Chmouel Boudjnah <chmouel@chmouel.com>"
import os
import cloudfiles
from glance.parallax import db
USERNAME = "c" # fill these out for testing
API_KEY = ""
AUTH_URL = "https://auth.api.rackspacecloud.com/v1.0"