This file contains hidden or 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
buildings = [ | |
[1, 11, 5], | |
[2, 6, 7], | |
[3, 13, 9], | |
[12, 7, 16], | |
[14, 3, 25], | |
[19, 18, 22], | |
[23, 13, 29], | |
[24, 4, 28], | |
] |
This file contains hidden or 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
# This implementation works, but it does all comparisons twice | |
# and is not in-place, requiring extra memory and raising | |
# a stack overflow for large arrays. | |
def quicksort(array) | |
return array if array.size <= 1 | |
pivot = array.pop | |
less = array.select {|x| x <= pivot } | |
greater = array.select {|x| x > pivot } | |
quicksort(less) + [pivot] + quicksort(greater) |
This file contains hidden or 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
#include <stdio.h>; | |
int fib(int n) { | |
if (n == 1) { | |
return 1; | |
} else if (n == 0) { | |
return 0; | |
} else { | |
return fib(n - 1) + fib(n - 2); | |
} |
This file contains hidden or 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
[root@videos3s2 goal]# /opt/generic/python27/bin/python translate.py -O2 | |
[platform:msg] Set platform with 'host' cc=None, using cc='gcc' | |
[translation:info] Translating target as defined by targetpypystandalone | |
[platform:execute] gcc -c -O3 -pthread -fomit-frame-pointer -Wall -Wno-unused /tmp/usession-release-1.9-8/gcctest.c -o /tmp/usession-release-1.9-8/gcctest.o | |
[platform:execute] gcc /tmp/usession-release-1.9-8/gcctest.o -pthread -lrt -o /tmp/usession-release-1.9-8/gcctest | |
[platform:execute] gcc -c -O3 -pthread -fomit-frame-pointer -Wall -Wno-unused /tmp/usession-release-1.9-8/platcheck_0.c -o /tmp/usession-release-1.9-8/platcheck_0.o | |
[platform:execute] gcc /tmp/usession-release-1.9-8/platcheck_0.o -pthread -lrt -o /tmp/usession-release-1.9-8/platcheck_0 | |
[platform:execute] gcc -c -O3 -pthread -fomit-frame-pointer -Wall -Wno-unused /tmp/usession-release-1.9-8/platcheck_1.c -o /tmp/usession-release-1.9-8/platcheck_1.o | |
[platform:execute] gcc /tmp/usession-release-1.9-8/platcheck_1.o -pthread -lrt -o /tmp/uses |
This file contains hidden or 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
[translation:info] written: /tmp/usession-release-1.9-17/testing_1/testing_1.c | |
[translation:info] Compiling c source... | |
[platform:execute] make -j 5 in /tmp/usession-release-1.9-17/testing_1 | |
[platform:Error] data_module_cpyext_pyobject.c:133: warning: initialization from incompatible pointer type | |
[platform:Error] data_module_cpyext_pyobject.c:173: warning: initialization from incompatible pointer type | |
[platform:Error] data_module_cpyext_pyobject.c:303: warning: initialization from incompatible pointer type | |
[platform:Error] data_module_cpyext_pyobject.c:323: warning: initialization from incompatible pointer type | |
[platform:Error] data_module_cpyext_pyobject.c:433: warning: initialization from incompatible pointer type | |
[platform:Error] data_module_cpyext_pyobject.c:453: warning: initialization from incompatible pointer type | |
[platform:Error] data_module_cpyext_pyobject.c:548: warning: initialization from incompatible pointer type |
This file contains hidden or 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
/opt/generic/python27/bin/python | |
Python 2.7.1 (r271:86832, May 19 2011, 15:54:57) | |
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> all | |
<built-in function all> |
This file contains hidden or 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
{ | |
"streams": { | |
"Nasa-high": { | |
"input-path": "/msfc/Wifi.m3u8", | |
"servers": ["http://liveips.nasa.gov.edgesuite.net"], | |
"bandwidth": 1080434 | |
} | |
}, | |
"actions": [ |
This file contains hidden or 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
class O(): | |
def __repr__(self): | |
return "<" + ' *o* '.join(map(repr, self.funs)) + ">" if self.funs else "<composer>" | |
def __init__(self, funs=None): | |
self.funs = funs if funs else [] | |
def __rmul__(self, other): | |
other_funs = other.funs if isinstance(other, O) else [other] | |
return O(other_funs + self.funs) |
This file contains hidden or 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
def msort(xs: List[Int]): List[Int] = { | |
val n = xs.length / 2 | |
if (n == 0) xs | |
else { | |
def merge(xs: List[Int], ys: List[Int]): List[Int] = (xs, ys) match { | |
case (Nil, ys) => ys | |
case (xs, Nil) => xs | |
case (x :: xs1, y :: ys1) => | |
if (x < y) x :: merge(xs1, ys) | |
else y :: merge(xs, ys1) |
This file contains hidden or 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
def print_pascal_triangle(n_lines): | |
for row in xrange(n_lines): | |
for col in xrange(row + 1): | |
print pascal(row, col), | |
def pascal(row, col): | |
if col == 0 or row == col: | |
return 1 |