Skip to content

Instantly share code, notes, and snippets.


Samuel Sutch samuraisam

View GitHub Profile
samuraisam /
Last active Jan 20, 2022
Deep Equality Test for Nested Python Structures
#Copyright (c) 2010-2013 Samuel Sutch []
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is
#furnished to do so, subject to the following conditions:
#The above copyright notice and this permission notice shall be included in
samuraisam /
Created May 16, 2012
Parse an accept header in Python w/ support for vendor types
# The author disclaims copyright to this source code. In place of a legal
# notice, here is a blessing:
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
# It is based on a snipped found in this project:
samuraisam /
Created Jun 16, 2014
Python: Fluent Builder Pattern
class ObjectPermissions(object):
perms_map = {}
specific_object_perms = ()
def require(cls, *new_perms):
class SpecificObjectPermissions(cls):
specific_object_perms = new_perms
return SpecificObjectPermissions
package org.brd.blockchaindb.chaindata.cassandra.cql;
import lombok.extern.slf4j.Slf4j;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
samuraisam /
Created Apr 12, 2017
Generates a Go vendor directory in a bazel workspace
#!/usr/bin/env python3
import ast
import collections
import os
import subprocess
import sys
import time
View transaction.json
"transaction_id": "bitcoin-testnet:e6d0bbd26772456dc0e64221701e734854737476fcb23a0f77d721e5f27a9685",
"identifier": "e6d0bbd26772456dc0e64221701e734854737476fcb23a0f77d721e5f27a9685",
"hash": "5c6fb67fc71a80dbb0853db1b00f7a608426bbaf1d8a63125a70fe524cdbe5b7",
"blockchain_id": "bitcoin-testnet",
"timestamp": "1970-01-19T03:18:15.847+0000",
"_embedded": {
"transfers": [
"transfer_id": "bitcoin-testnet:e6d0bbd26772456dc0e64221701e734854737476fcb23a0f77d721e5f27a9685:0",
View fees.json
"_embedded": {
"blockchains": [
"name": "Bitcoin Cash",
"id": "bitcoincash-mainnet",
"native_currency_id": "bitcoincash-mainnet:__native__",
"fee_estimates": [
"fee": {
samuraisam /
Last active Feb 22, 2019
Using STS (Security Token Service) to grant access for a federated user to a s3 bucket prefix
import json
import boto
from django.db import models
from django.conf import settings
from django.contrib.auth.models import User
class UploadToken(models.Model):
user = models.ForeignKey(User)
created = models.DateTimeField(auto_now_add=True)
View BRDCrowdsale.sol
pragma solidity ^0.4.18;
// File: contracts/zeppelin-solidity-1.4/Ownable.sol
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
contract Ownable {
View gist:6af2cbd886b2e76cac9b8bc346718353