This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import base64, urllib, urllib2 | |
api_key = "api:" + "key-MAILGUN_KEY" | |
routes_url = 'http://mailgun.net/api/routes.xml' | |
messages_url = 'http://mailgun.net/api/messages.txt' | |
def create_routes(pattern, destination): | |
post_headers = { | |
'Authorization': 'Basic {0}'.format(base64.b64encode(api_key)), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) 2011, Eng Eder de Souza | |
# ___ _ _ ___ | |
# | __|__| |___ _ _ __| |___ / __| ___ _ _ _____ _ | |
# | _|/ _` / -_) '_| / _` / -_) \__ \/ _ \ || |_ / _` | | |
# |___\__,_\___|_| \__,_\___| |___/\___/\_,_/__\__,_| | |
#Accessing the Google API for speech recognition! | |
#Open a file type Wav to speech recognition | |
#This source does not require any external programs to perform audio conversions :-) | |
#http://ederwander.wordpress.com/2011/11/06/accessing-the-google-speech-api-python/ | |
#Eng Eder de Souza |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bubble sort (inefficient for sorting large data volumes) | |
require 'test/unit' | |
def sort(a) | |
swapped = true | |
n = a.size | |
j = 0 | |
while swapped do | |
swapped = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Insertion sort (inefficient on large lists) | |
require 'test/unit' | |
def sort(a) | |
n = a.size - 1 | |
1.upto(n) do |i| | |
new_value = a[i] | |
j = i | |
while j > 0 && a[j - 1] > new_value do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Selection sort (very slow on large lists) | |
a = [9,8,6,1,2,5,4,3,9,50,12,11] | |
n = a.size - 1 | |
n.times do |i| | |
index_min = i | |
(i + 1).upto(n) do |j| | |
index_min = j if a[j] < a[index_min] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ruby 1.9.2 | |
# Home: https://gist.github.com/856219 | |
# My CPP template: template_cpp.rb | |
# OJ Support: | |
# Online Judge of Zhejiang University | |
# Author: [email protected] | |
require 'uri' | |
require 'net/http' | |
#require 'hpricot' |