Skip to content

Instantly share code, notes, and snippets.

View pipermerriam's full-sized avatar

Piper Merriam pipermerriam

  • Ethereum Foundation
  • Boulder Colorado
View GitHub Profile
@axic
axic / ecverify.sol
Last active April 13, 2024 09:01
Ethereum ECVerify
//
// The new assembly support in Solidity makes writing helpers easy.
// Many have complained how complex it is to use `ecrecover`, especially in conjunction
// with the `eth_sign` RPC call. Here is a helper, which makes that a matter of a single call.
//
// Sample input parameters:
// (with v=0)
// "0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad",
// "0xaca7da997ad177f040240cdccf6905b71ab16b74434388c3a72f34fd25d6439346b2bac274ff29b48b3ea6e2d04c1336eaceafda3c53ab483fc3ff12fac3ebf200",
// "0x0e5cb767cce09a7f3ca594df118aa519be5e2b5a"
#!/usr/bin/env node
var solc = require('solc');
var fs = require('fs');
var source = fs.readFileSync("test/constructor.sol", 'utf8');
console.log(solc.version());
var output = solc.compile(source,1);
console.log(output);
@non
non / answer.md
Last active January 9, 2024 22:06
answer @nuttycom

What is the appeal of dynamically-typed languages?

Kris Nuttycombe asks:

I genuinely wish I understood the appeal of unityped languages better. Can someone who really knows both well-typed and unityped explain?

I think the terms well-typed and unityped are a bit of question-begging here (you might as well say good-typed versus bad-typed), so instead I will say statically-typed and dynamically-typed.

I'm going to approach this article using Scala to stand-in for static typing and Python for dynamic typing. I feel like I am credibly proficient both languages: I don't currently write a lot of Python, but I still have affection for the language, and have probably written hundreds of thousands of lines of Python code over the years.

{
   "Statement":[
      {
         "Effect":"Allow",
       
         "Action":[
            "s3:ListAllMyBuckets"
         ],
         "Resource":"arn:aws:s3:::*"
      },
@wlonk
wlonk / dictionary_defaults.py
Last active August 29, 2015 14:10
Return a dict with defaults.
foo = {
...
}
defaults = {
...
}
foo = dict(defaults, **foo) # Or assign to somewhere else, whatever, I'm not picky.
@rockymeza
rockymeza / django-strorages.json
Created August 5, 2013 16:00
AWS IAM Policy for S3 for django-storages
{
   "Statement":[
      {
         "Effect":"Allow",
       
         "Action":[
            "s3:ListAllMyBuckets"
         ],
         "Resource":"arn:aws:s3:::*"
      },
@AndrewIngram
AndrewIngram / storages.py
Created June 18, 2013 09:22
Hybrid Storage Backend for Django
from django.conf import settings
from django.core.files.storage import Storage
from django.utils import importlib
def load_class(class_string):
class_module, class_name = class_string.rsplit('.', 1)
class_module = importlib.import_module(class_module)
return getattr(class_module, class_name)
@davesque
davesque / .pythonrc.py
Last active December 18, 2015 01:59
Cleaned up .pythonrc.py file
from code import InteractiveConsole
import os
import sys
completer_locals = locals()
HISTFILE = os.path.expanduser("%s/.pyhistory" % os.environ["HOME"])
@vdboor
vdboor / mixins.py
Created October 31, 2012 08:52
Django view initialization ordering issues
class BaseViewMixin(object):
def dispatch(self, request, *args, **kwargs):
# Set earlier to let get_loggedin_user() and get_context_user() work.
# They run before the get() and post() methods are called.
self.request = request
self.args = args
self.kwargs = kwargs
# Run checks before entering the view.