Skip to content

Instantly share code, notes, and snippets.

View mahmoudimus's full-sized avatar
💭
@_@

Mahmoud Rusty Abdelkader mahmoudimus

💭
@_@
View GitHub Profile
#!/usr/bin/env python
# Using BaseHTTPServer for mocking servers
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from threading import Thread
from time import sleep, time
from urllib import urlopen
import httplib
/*
`hello` is a function that prints a greeting that is personalized based on
the name given.
# Arguments
* `name` - The name of the person you'd like to greet.
# Example
@mahmoudimus
mahmoudimus / pyramid class views.py
Last active August 29, 2015 14:04
My attempt at building a framework for pyramid class views to integrate into pyramid_maze
# Doesn't work..
from inspect import getmembers, ismethod
from pyramid.config import Configurator
from pyramid.response import Response
import venusian
from pyramid_maze import Node, Graph

Google Speech To Text API

Base URL: https://www.google.com/speech-api/v1/recognize
It accepts POST requests with voice file encoded in FLAC format, and query parameters for control.

Query Parameters

client
The client's name you're connecting from. For spoofing purposes, let's use chromium

lang
Speech language, for example, ar-QA for Qatari Arabic, or en-US for U.S. English

@mahmoudimus
mahmoudimus / uuid.py
Created August 30, 2014 21:42
uuid.py compatible with python 2.3+
# taken from: http://zesty.ca/python/uuid.py
r"""UUID objects (universally unique identifiers) according to RFC 4122.
This module provides immutable UUID objects (class UUID) and the functions
uuid1(), uuid3(), uuid4(), uuid5() for generating version 1, 3, 4, and 5
UUIDs as specified in RFC 4122.
If all you want is a unique ID, you should probably call uuid1() or uuid4().
Note that uuid1() may compromise privacy since it creates a UUID containing
the computer's network address. uuid4() creates a random UUID.
@mahmoudimus
mahmoudimus / make_enum.py
Created September 16, 2014 05:17
enum migrate generator template
"""
1. Run this from the pound virtual environment
2. Usage is:
python make_enum.py --file=/absolute/path/to/migration arg1 arg2 arg3 arg4
arg1 - The enum class from `pound.models` that you want to add an enum to
arg2 - The database table that has the enum type on
arg3 - The column on the database table that is of that type
arg4 - The new enum tuples to add.
{
"Statement":[
{
"Action":[
"route53:ChangeResourceRecordSets",
"route53:GetHostedZone",
"route53:ListResourceRecordSets"
],
"Effect":"Allow",
"Resource":[
@mahmoudimus
mahmoudimus / migrate-submodules-to-yml.py
Created November 21, 2014 22:58
Migrate your .gitmodule (git submodule) file to yaml format for some sweet ansible-galaxy support ( 1.8+ )
#!/usr/bin/python
import argparse
import sys
import logging
import ConfigParser as configparser
import StringIO
import yaml
logger = logging.getLogger(__name__)
#!/bin/bash
#
# this script will attempt to detect any ephemeral drives on an EC2 node and create a RAID-0 stripe
# mounted at /mnt. It should be run early on the first boot of the system.
#
# Beware, This script is NOT fully idempotent.
#
METADATA_URL_BASE="http://169.254.169.254/2012-01-12"
#!/bin/bash -e
####
# based on https://gist.github.com/jeffery/1115504
# Helper script to update the Last modified timestamp of files in a Git SCM
# Projects working Copy
#
# When you clone a Git repository, it sets the timestamp of all the files to the
# time when you cloned the repository.
#
# This becomes a problem when you want the cloned repository, which is part of a