Skip to content

Instantly share code, notes, and snippets.

View eob's full-sized avatar

Ted Benson eob

View GitHub Profile
@eob
eob / Polynomial Fitting
Created April 22, 2014 02:14
Polynomial Fitting
from scipy.optimize import curve_fit
from collections import Counter, defaultdict
import numpy as np
import time
def f(xss, a, b, c, d, e, f):
"""
Polynomial function up to order 5
"""
ret = []
I’ve worked in an economy that rewards someone who saves the lives of others on a battlefield with a
medal, rewards a great teacher with thank-you notes from parents, but rewards those who can detect
the mispricing of securities with sums reaching into the billions. In short, fate’s distribution of long
straws is wildly capricious.
From Warren Buffett's Giving Pledge
http://givingpledge.org/pdf/letters/Buffett_Letter.pdf
from scapy.all import *
def arp_display(pkt):
if pkt[ARP].op == 1: #who-has (request)
if pkt[ARP].psrc == '0.0.0.0': # ARP Probe
print "ARP Probe from: " + pkt[ARP].hwsrc
print sniff(prn=arp_display, filter="arp", store=0, count=10)
from scapy.all import *
def arp_display(pkt):
if pkt[ARP].op == 1: #who-has (request)
if pkt[ARP].psrc == '0.0.0.0': # ARP Probe
if pkt[ARP].hwsrc == '74:75:48:5f:99:30': # Huggies
print "Pushed Huggies"
elif pkt[ARP].hwsrc == '10:ae:60:00:4d:f3': # Elements
print "Pushed Elements"
else:
print "ARP Probe from unknown device: " + pkt[ARP].hwsrc
from scapy.all import *
import requests
import time
MAGIC_FORM_URL = 'http://put-your-url-here'
def record_poop():
data = {
"Timestamp": time.strftime("%Y-%m-%d %H:%M"),
"Measurement": 'Poopy Diaper'
}
@eob
eob / gist:d597f558890c2c05a73a
Created August 9, 2015 10:12
record-poop.py
def record_poop():
data = {
"Timestamp": time.strftime("%Y-%m-%d %H:%M"),
"Measurement": 'Poopy Diaper'
}
requests.post(MAGIC_FORM_URL, data)
<form method="POST" action="//api.cloudstitch.com/ted/magic-form-3/datasources/sheet" enctype="multipart/form-data" class="magic-form">
<input name="FirstName" placeholder="First Name" />
<input name="LastName" placeholder="Last Name" />
<input name="Picture" type="file" >
<input type="hidden" name="_redirect" value="http://www.google.com">
<button type="submit" class="form-btn">Regular Submit</button>
</form>
<h2>Not logged in</h1>
<stitch-toolbar logo></stitch-toolbar>
<h2>Logged in</h1>
<stitch-toolbar username="eob" logo></stitch-toolbar>
<h2>Transparent</h1>
<div style="height:200px; background-image: url(night.png);">
<stitch-toolbar transparent username="eob" logo></stitch-toolbar>
</div>
<body>
<stitch-docpage title="About Cloudstitch">
<h2>We're building the web stack for the cloud era</h2>
...
</stitch-docpage>
</body>
=IF(
NOT(ISBLANK($A2)),
IFERROR(
JOIN(
"\\n\\n",
filter(Comments!$C$2:$C,Comments!$A$2:$A=$A2)
)
),
""
)