Skip to content

Instantly share code, notes, and snippets.

View mpetyx's full-sized avatar

Michael Petychakis mpetyx

View GitHub Profile
@mpetyx
mpetyx / pytriplets
Last active August 29, 2015 14:07 — forked from VHarisop/pytriplets
__author__ = 'mpetyx'
''' Pythagorean triplets are integers (a, b, c) for which the property
a^2 + b^2 = c^2 holds. The following script is a dummy implementation that runs in 12.5s '''
lim = 500
for i in range(1, lim):
for j in range(i+1, lim):
for k in range(j+1, lim):
if i**2 + j**2 == k**2:
@mpetyx
mpetyx / Hardy-RamanujanNumber
Created October 2, 2014 11:38
Hardy Ramanujan Number in Python. A sample implementation with no optimizations
__author__ = 'mpetyx'
for x in range(1, 2000):
for y in range(1, 2000):
for z in range(1, 2000):
for g in range(1, 2000):
if g * g * g + z * z * z == x * x * x + y * y * y:
if (g == z) or (g == y) or (g == x) or (z == y) or (z == x) or (y == x):
continue
else:
@mpetyx
mpetyx / response from mule studio apikit for twitter.raml example
Created April 3, 2014 10:39
response from mule studio apikit for twitter.raml example
{"context":"while validating security scheme","context_mark":null,"message":"requestTokenUri must be a URL","problem_mark":{"name":"http://localhost:8081/api","line":24,"column":16,"buffer":"#%RAML 0.8\ntitle: \"Twitter API\"\nversion: \"1.1\"\nbaseUri: \"http://localhost:8081/api\"\nmediaType: \"application/json\"\nresourceTypes: \n - \n \"base\": \n displayName: \"base\"\ntraits: \n - \n \"nestedable\": \n displayName: \"nestedable\"\n - \n \"trimmable\": \n displayName: \"trimmable\"\nsecuritySchemes: \n - \n \"oauth_1_0\": \n description: |\n Twitter offers applications the ability to issue authenticated requests on \n behalf of the application itself (as opposed to on behalf of a specific user). \n type: \"OAuth 1.0\"\n settings: \n \"requestTokenUri\": [\"https://api.twitter.com/oauth/request_token\"]\n \"authorizationUri\": [\"https://api.twitter.com/oauth/authorize\"]\n \"tokenCredentialsUri\": [\"https://api.twitter.com/oauth/access_token\"]\nsecuredBy: \n - \n oauth_1_0\n\"/statuses\": \n \"/oembed{
@mpetyx
mpetyx / failing output from libcouchbase installation on heroku
Created January 3, 2014 13:41
failing output from libcouchbase installation on heroku
mpetyx$ git push heroku master
Fetching repository, done.
Counting objects: 12, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (9/9), 1.79 KiB | 0 bytes/s, done.
Total 9 (delta 4), reused 0 (delta 0)
-----> Fetching custom git buildpack... done
-----> Python app detected