Skip to content

Instantly share code, notes, and snippets.

View JulesWang's full-sized avatar

juleswang JulesWang

View GitHub Profile
@kiarashplusplus
kiarashplusplus / .py
Created January 9, 2016 23:27
AWS Lambda + Mailgun
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)),
@ederwander
ederwander / gist:1342497
Created November 6, 2011 05:01
Accessing the Google Speech API + Python
# 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
@brianstorti
brianstorti / bubble_sort.rb
Created May 3, 2011 18:12
Bubble sort in ruby
# 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
@brianstorti
brianstorti / insertion_sort.rb
Created May 3, 2011 14:41
Insertion sort in ruby
# 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
@brianstorti
brianstorti / selection_sort.rb
Created May 3, 2011 13:19
Selection Sort in ruby
# 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]
@JulesWang
JulesWang / acm_bot.rb
Created March 5, 2011 08:08
A acm bot do some boring work
# 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'