Skip to content

Instantly share code, notes, and snippets.

View hltbra's full-sized avatar

Hugo Lopes Tavares hltbra

View GitHub Profile
@hltbra
hltbra / pascal.py
Created November 20, 2012 13:01
Pascal triangule using recursion
def print_pascal_triangle(n_lines):
for row in xrange(n_lines):
for col in xrange(row + 1):
print pascal(row, col),
print
def pascal(row, col):
if row == 0 or col == 0 or row == col:
return 1
@hltbra
hltbra / shell-output
Created October 3, 2012 17:05
about my answer to stackoverflow "pip: dealing with multiple Python versions?" question
$ pip install --upgrade pip
Downloading/unpacking pip
Downloading pip-1.2.1.tar.gz (102Kb): 102Kb downloaded
Running setup.py egg_info for package pip
warning: no files found matching '*.html' under directory 'docs'
warning: no previously-included files matching '*.txt' found under directory 'docs/_build'
no previously-included directories found matching 'docs/_build/_sources'
Installing collected packages: pip
Found existing installation: pip 1.0.2
@hltbra
hltbra / hlsclient_input_v2.json
Created September 27, 2012 20:01
New input JSON for hlsclient
{
"streams": {
"Nasa-low": {
"input-path": "/msfc/Edge.m3u8",
"output-path": "/nasa/Edge.m3u8",
"servers": ["http://liveips.nasa.gov.edgesuite.net"],
"bandwidth": 254082
},
"Nasa-medium": {
"input-path": "/msfc/3G.m3u8",
# output runninig on hltbra's macbook
# using python2.7
# see http://stackoverflow.com/questions/11659179/what-difference-between-pip-install-and-setup-py-install-for-static-files
$ virtualenv --no-site-packages F --python=$(which python2.7)
Running virtualenv with interpreter /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
New python executable in F/bin/python
Installing setuptools............done.
Installing pip...............done.
@hltbra
hltbra / should_dsl_py27_fail_output
Created July 4, 2012 16:48
Should-DSL tests fail on Python2.7
$ python run_all_examples.py
/Users/hugo/github_projects/should-dsl/docs/available_matchers.rst
Doctest: available_matchers.rst ... FAIL
/Users/hugo/github_projects/should-dsl/docs/community.rst
Doctest: community.rst ... ok
/Users/hugo/github_projects/should-dsl/docs/contributing.rst
Doctest: contributing.rst ... ok
/Users/hugo/github_projects/should-dsl/docs/custom_matchers.rst
Doctest: custom_matchers.rst ... ok
/Users/hugo/github_projects/should-dsl/docs/download.rst
@hltbra
hltbra / gist:2989843
Created June 25, 2012 16:53
Perfomance example [b]
#include <string.h>
enum {
BIG = 1000000,
SMALL = 1000
};
int main() {
int i, j;
@hltbra
hltbra / gist:2989832
Created June 25, 2012 16:51
Perfomance example [a]
#include <string.h>
enum {
BIG = 1000000,
SMALL = 1000
};
int main() {
int i, j;
unsigned a[BIG], b[BIG];
@hltbra
hltbra / gist:2776437
Created May 23, 2012 17:12
watch_html5_player.html
<!DOCTYPE html>
<!-- written by Hugo Lopes Tavares -->
<html>
<head>
<style>
#content {
margin: 0 auto;
text-align: center;
}
#controls * {
// ==UserScript==
// @name Udacity EXT - Auto next video&quiz
// @description Udacity Extension -- Automatically go to the next video or quiz question upon reaching the end of the current one
// @namespace http://sepczuk.com/
// @version 0.2
// @include http://www.udacity.com/view*
// @match http://www.udacity.com/view*
// @copyright 2012, Damian Sepczuk, Hugo Lopes Tavares
// ==/UserScript==
@hltbra
hltbra / udacity_autonext_ext_new_ui.patch
Created May 15, 2012 23:23
Patch Udacity EXT auto next video & quiz
--- udacity_ext.js 2012-05-15 20:19:44.000000000 -0300
+++ udacity_ext_new_ui.js 2012-05-15 20:22:49.000000000 -0300
@@ -5,7 +5,7 @@
// @version 0.1
// @include http://www.udacity.com/view*
// @match http://www.udacity.com/view*
-// @copyright 2012, Damian Sepczuk
+// @copyright 2012, Damian Sepczuk, Hugo Lopes Tavares
// ==/UserScript==