Skip to content

Instantly share code, notes, and snippets.

View ramalho's full-sized avatar
🏠
Working from home

Luciano Ramalho ramalho

🏠
Working from home
View GitHub Profile
@ramalho
ramalho / pmp2jpeg.py
Created November 12, 2017 23:08
Utility to "convert" Sony PMP photo files to JPEG
#!/usr/bin/env python3
"""Extract JPEG files from Sony PMP files"""
import sys
import os
for name in sys.argv[1:]:
print(name, end='->')
with open(name, 'rb') as fp:
@ramalho
ramalho / flag-2
Created October 22, 2017 16:46
Bandeira do Brasil
stroke 0
# Start by drawing a green background.
background "#009b3a"
# We'll draw the yellow diamond as two triangles: a top, and a bottom.
color "#fedf00"
move -200
polygon 0, 0, 200, -130, 400, 0 # Top Half
@ramalho
ramalho / gist:e56ac0c0454540cf259c316a567ad188
Created October 22, 2017 16:45
Brazilian flag (simple)
stroke 0
# Start by drawing a green background.
background "#009b3a"
# We'll draw the yellow diamond as two triangles: a top, and a bottom.
color "#fedf00"
move -200
polygon 0, 0, 200, -130, 400, 0 # Top Half
@ramalho
ramalho / pense-como-pythonista.html
Created July 22, 2017 16:51
Pense como uma pythonista
<!DOCTYPE html>
<html>
<head><meta charset="utf-8" />
<title>Pense como uma pythonista</title><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<style type="text/css">
/*!
*
* Twitter Bootstrap
@ramalho
ramalho / gnome-version.py
Last active May 1, 2017 01:29
Simple script to display Gnome 3 version
#!/usr/bin/env python3
import xml.etree.ElementTree as ET
tags = 'platform minor micro'.split()
doc = ET.parse('/usr/share/gnome/gnome-version.xml')
print('.'.join(doc.find(tag).text for tag in tags))
@ramalho
ramalho / RethinkDB-why-we-failed.md
Created January 19, 2017 14:46
RethinkDB: why we failed
layout title
post
RethinkDB: why we failed

Posted on Github by Slava Akhmechet

When we [announced][shutdown-announcement] that RethinkDB is shutting down, I promised to write a post-mortem. I took some time to process the experience, and I can now write about it clearly.

Keybase proof

I hereby claim:

  • I am ramalho on github.
  • I am ramalho (https://keybase.io/ramalho) on keybase.
  • I have a public key whose fingerprint is CAF0 10C6 5EED B222 EB8B 044A D284 12E9 7687 D71E

To claim this, I am signing this object:

@ramalho
ramalho / genius.py
Created October 22, 2015 21:03
Genius clone on Raspberry Pi with Pingo.io, edited live on Midori
import time
import random
import pingo
import itertools
rpi = pingo.detect.get_board()
class Buzzer(object):
https://maps.googleapis.com/maps/api/staticmap?center=40.714728,-73.998672&zoom=16&size=600x300&maptype=hybrid&key=AIzaSyApIx-jA9MblvDcvwBB3VxzKhGEWwLsY1k
@ramalho
ramalho / file_exception.py
Last active September 7, 2015 21:51
Simple file handling exception example
while True:
filename = input('Enter the name of a file to open: ')
try:
# open for reading in binary mode, so any file will do
fin = open(filename, 'rb')
except OSError as exc:
print('Something untoward happened [%r]' % exc)
else:
break