Skip to content

Instantly share code, notes, and snippets.

@anfedorov
anfedorov / echoHttpRequest.js
Last active August 29, 2015 14:08 — forked from Marak/echoHttpRequest.js
Echo HTTP requests
module['exports'] = function echoHttp (hook) {
hook.debug("Debug messages are sent to the debug console");
hook.debug(hook.params);
hook.debug(hook.req.path);
hook.debug(hook.req.method);
import re
from collections import namedtuple
from decimal import Decimal
from dateutil import parser
from functools import partial
token_parsers = {
'decimal': Decimal,
'payee': str,
- payments.country_in_gbp.BD {u'gross': Decimal('28.20'), u'vat': Decimal('0.00')}
- payments.country_in_gbp.BE.gross 53074.64
+ payments.country_in_gbp.BE.gross 14343.75
- payments.country_in_gbp.BE.vat 8558.45
+ payments.country_in_gbp.BE.vat 3012.19
- payments.country_in_gbp.BG.gross 6356.18
+ payments.country_in_gbp.BG.gross 1757.58
- payments.country_in_gbp.BG.vat 999.45
+ payments.country_in_gbp.BG.vat 351.52
- payments.country_in_gbp.BA {u'gross': Decimal('688.18'), u'vat': Decimal('0.00')}
- payments.payees_in_usd.humblebundle 101157.13
+ payments.payees_in_usd.humblebundle 100485.58
- payments.payees_in_usd.humblebundle_widget 37060.63
+ payments.payees_in_usd.humblebundle_widget 36389.08
+ payments.payees_in_usd.brandonboyercancertreatment 671.55
- reports.brandonboyer_widget.USD45.hb_fee 43.49
+ reports.brandonboyer_widget.USD45.hb_fee 0.00
- reports.brandonboyer_widget.USD45.charity 0.00
+ reports.brandonboyer_widget.USD45.charity 43.49
- reports.brandonboyer_widget.USD25.00.hb_fee 628.06
- payments.country_in_gbp.BE.gross 14343.75
+ payments.country_in_gbp.BE.gross 53074.64
- payments.country_in_gbp.BE.vat 3012.19
+ payments.country_in_gbp.BE.vat 8558.45
- payments.country_in_gbp.FR.gross 102362.55
+ payments.country_in_gbp.FR.gross 376609.59
- payments.country_in_gbp.FR.vat 20472.51
+ payments.country_in_gbp.FR.vat 57926.53
- payments.country_in_gbp.BG.gross 1757.58
+ payments.country_in_gbp.BG.gross 6356.18
- payments.payees_in_usd.humblebundle 245021.85
+ payments.payees_in_usd.humblebundle 163384.71
- payments.payees_in_usd.humblebundle_widget 142837.30
+ payments.payees_in_usd.humblebundle_widget 61200.16
+ payments.payees_in_usd.brandonboyercancertreatment 81637.14
- reports.brandonboyer_widget.USD35.00.hb_fee 101.95
+ reports.brandonboyer_widget.USD35.00.hb_fee 0.00
- reports.brandonboyer_widget.USD35.00.charity 0.00
+ reports.brandonboyer_widget.USD35.00.charity 101.95
- reports.brandonboyer_widget.USD27.hb_fee 26.02

Keybase proof

I hereby claim:

  • I am anfedorov on github.
  • I am anfedorov (https://keybase.io/anfedorov) on keybase.
  • I have the public key with fingerprint 3326 870B 5336 C667 CE9C  1E1D 5097 5FC8 CD6A EEFB

To claim this, I am signing this object:

@anfedorov
anfedorov / crypto1.py
Created September 20, 2013 06:43
Exercise from Coursera's Crypto I
def hex2bitlist(s):
return [int(s[:2], 16)] + hex2bitlist(s[2:]) if s else []
cs = map(
hex2bitlist,
[
'315c4eeaa8b5f8aaf9174145bf43e1784b8fa00dc71d885a804e5ee9fa40b16349c146fb778cdf2d3aff021dfff5b403b510d0d0455468aeb98622b137dae857553ccd8883a7bc37520e06e515d22c954eba5025b8cc57ee59418ce7dc6bc41556bdb36bbca3e8774301fbcaa3b83b220809560987815f65286764703de0f3d524400a19b159610b11ef3e',
'234c02ecbbfbafa3ed18510abd11fa724fcda2018a1a8342cf064bbde548b12b07df44ba7191d9606ef4081ffde5ad46a5069d9f7f543bedb9c861bf29c7e205132eda9382b0bc2c5c4b45f919cf3a9f1cb74151f6d551f4480c82b2cb24cc5b028aa76eb7b4ab24171ab3cdadb8356f',
'32510ba9a7b2bba9b8005d43a304b5714cc0bb0c8a34884dd91304b8ad40b62b07df44ba6e9d8a2368e51d04e0e7b207b70b9b8261112bacb6c866a232dfe257527dc29398f5f3251a0d47e503c66e935de81230b59b7afb5f41afa8d661cb',
'32510ba9aab2a8a4fd06414fb517b5605cc0aa0dc91a8908c2064ba8ad5ea06a029056f47a8ad3306ef5021eafe1ac01a81197847a5c68a1b78769a37bc8f4575432c198ccb4ef63590256e305cd3a9544ee4160ead45aef520489e7da7d83540
@anfedorov
anfedorov / diff_dict_recur.py
Created August 15, 2013 23:43
recursively diff two dicts
def diff_dicts_recur(dict1, dict2, prefix=tuple()):
"""Takes the diff of two dicts, recursively."""
for k, v in dict1.iteritems():
if k not in dict2:
# only in dict1
yield ('-', prefix + (k,), v)
else:
w = dict2[k]
if w != v: # in both, but different values
if isinstance(w, dict) and isinstance(v, dict):
<!DOCTYPE html>
<html>
<head>
<meta name="referrer" content="never">
</head>
<body>
<script language="JavaScript">
<!--