Skip to content

Instantly share code, notes, and snippets.

CELO_VALIDATOR_GROUP_ADDRESS=a23049064ddc56b436bb95f6b1512c553ab61d22 CELO_VALIDATOR_ADDRESS=9a4b4f0469e5a871a27cc9451ce69a6cf769d757 CELO_GENESIS_VALIDATOR_SIGNER_ADDRESS=aa3b76b6618afe574b278da9b71af0e66aa6f646 CELO_GENESIS_VALIDATOR_SIGNER_BLS_PUBLIC_KEY=348aa54a71033d583a29d00e3dfb1f696633c6520bc71099fd26a228d1882f380ab86ef19b7efe544d47ba8aeddf770125075f6c15b82611a31e746668c1aa8af2355efe6e4cd297c0f570fce18ecc2f274bef5115a8d8ba9a18a6563e6c6181

@peterldowns
peterldowns / keybase.md
Created June 21, 2016 15:39
Keybase proof

Keybase proof

I hereby claim:

  • I am peterldowns on github.
  • I am peterldowns (https://keybase.io/peterldowns) on keybase.
  • I have a public key ASBOgThh7YFg9eOomzJsmLVpKdjVkBQR6rWKiCxqcC9eAAo

To claim this, I am signing this object:

#!/usr/bin/env python
# coding: utf-8
"""
The power of numbers is never more evident than when we use them to speculate
on the time of our dying. Sometimes I bargain with myself. Would I be willing
to accept sixty-five, Genghis Khan's age on dying? Suleiman the Magnificent
made it to seventy-six. That sounds all right, especially the way I feel now,
but how will it sound when I'm seventy-three?
Don DeLillo, White Noise
from functools import partial
def get_client_broken():
class Client(object):
def request(*args, **kwargs):
# ...
return True
# This fails to compile with"NameError: global name 'request' is not defined"
get, post, put, delete = map(lambda verb: partial(request, verb),
#!/usr/bin/env python
# coding: utf-8
import click
import math
from functools import partial
from itertools import imap
from sys import stdout
def fib(n, as_float=False):
@peterldowns
peterldowns / mock_object.py
Created July 9, 2014 01:01
Simple way of creating Mock objects from nested dictionaries.
import mock
def mock_object(data=None):
result = mock.MagicMock()
for key, value in data.iteritems():
if isinstance(value, dict):
result.configure_mock(**{
key: mock_object(value),
})
else:
result.configure_mock(**{
@peterldowns
peterldowns / git_aliases.sh
Created April 14, 2014 06:24
Git Aliases
alias g="git"
alias ga="git add"
alias gb="git branch"
alias gba="git branch -a"
alias gbd="git branch -d"
alias gbdr="git push origin --delete"
alias gc="git commit"
alias gca="git commit -a"
alias gch="git checkout"
alias gl="git log --pretty=format:'%Cred%h%Creset %s %Cgreen(%cr)%Creset %Cblue[%an]%Creset' --date=relative"
number = int(raw_input('Enter a number between 20 and 0: '))
# Only one of the following statements will print. If a condition
# (like "number < 20") is matched, then only that part of the block
# will run. That's what elif does. Else, if.
if number < 20:
print '%d is less than 20' % number
elif number < 10:
print '%d is less than 10' % number
elif number < 5:
@peterldowns
peterldowns / gmail.py
Created May 14, 2013 04:04
Short function for sending messages using a Gmail account.
def gmail(recipients, subject, message, sender_username, sender_password):
import smtplib
server = smtplib.SMTP('smtp.gmail.com', 587)
server.ehlo()
server.starttls()
server.ehlo()
server.login(username, password)
if not (isinstance(recipients, list) or isinstance(recipients, tuple)):
recipients = [recipients]
@peterldowns
peterldowns / style.less
Created February 1, 2013 06:19
Demo of responsive template with mixins.
// Rename:
// .locu-mobile-menu => .mobile-mixin
// .locu-web-menu => .web-mixin
// Then, use the mixins like so
@media screen and (max-width: 480px) {
.mobile-mixin;
}
// Keep this if you want the mobile preview to show your small-screen style