Skip to content

Instantly share code, notes, and snippets.

@rodydavis
rodydavis / flutter_github_ci.yml
Last active February 25, 2024 05:40
Flutter Github Actions Build and Deploy Web to Firebase Hosting, iOS to Testflight, Android to Google Play (fastlane)
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build_web:
@stefandeml
stefandeml / ZoKrates non-Repudiable Identity-Linked Proofs of Knowledge
Created April 8, 2019 12:46
ZoKrates non-Repudiable Identity-Linked Proofs of Knowledge
import "ecc/babyjubjubParams.code" as context
import "ecc/proofOfOwnership.code" as proofOfOwnership
import "hashes/sha256/512bitPacked.code" as sha256packed
def proofOfKnowledge(private field[4] secret, field[2] hash) -> (field):
// check that the computed hash matches the input
hash == sha256packed(secret)
return 1
def main(field[2] pkA, field[2] pkB, field[2] hash, private field skA, private field[4] secret, private field skB) -> (field):
@Vinc0682
Vinc0682 / Cargo.toml
Last active August 8, 2023 17:42
rust-sgx local attestation made easy
[dependencies]
sgx-isa = { version = "0.2", features = ["sgxstd"] }
# RustCrypto, used for CMAC
cmac = "0.2.0"
crypto-mac = "0.7.0"
aes = "0.3.2"
block-cipher-trait = "0.6.2"
generic-array = "0.12"
// The shuffle algorithm is similar to Algorithm P (Shuffle) from Knuth, 1969, in turn similar to the Fisher–Yates shuffle
// from 1938. It gets the position of an object from shufflingIndex, using a random number generator, and then updates the
// index so that the same position cannot be given to another object, and does so by switching places between the object
// that was picked, and the first object in the list, exchange shufflingIndex[randomNumber] and shufflingIndex[counter].
struct ShuffleAlgorithm {
mapping(uint => uint) shufflingIndex;
uint counter;
}
ShuffleAlgorithm shuffleUtility;
@BjornvdLaan
BjornvdLaan / BLSExample.sol
Last active April 10, 2023 07:49
Verification of BLS signatures and BGLS aggregate signatures in Ethereum
pragma solidity ^0.4.14;
/*
Example of how to verify BLS signatures and BGLS aggregate signatures in Ethereum.
Signatures are generated using https://github.com/Project-Arda/bgls
Code is based on https://github.com/jstoxrocky/zksnarks_example
*/
contract BLSExample {
@ygrenzinger
ygrenzinger / CleanArchitecture.md
Last active March 31, 2024 13:57
Summary of Clean Architecture by Robert C. Martin

Summary of book "Clean Architecture" by Robert C. Martin

Uncle Bob, the well known author of Clean Code, is coming back to us with a new book called Clean Architecture which wants to take a larger view on how to create software.

Even if Clean Code is one of the major book around OOP and code design (mainly by presenting the SOLID principles), I was not totally impressed by the book.

Clean Architecture leaves me with the same feeling, even if it's pushing the development world to do better, has some good stories and present robust principles to build software.

The book is build around 34 chapters organised in chapters.

Answers to Deep Questions about Solidity

The following list of questions was taken from https://www.reddit.com/r/ethereum/comments/72reba/do_you_have_deep_questions_about_solidity_or_the/

An updated summary on the different ways one could have two contracts interact (DELEGATECALL, STATICCALL, libraries, all that stuff) with clear pros/cons for each (gas cost, whether it requires EVM assembly directives, etc)

Question by /u/drcode

I won't talk about low-level opcodes here because of the brevity of the answer. In general, there are four ways functions can be called in Solidity:

sudo apt-get update
sudo apt-get install golang-go -y
wget https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-386.tar.gz
tar xvfz go-ipfs_v0.4.10_linux-386.tar.gz
sudo mv go-ipfs/ipfs /usr/local/bin/ipfs
# Make sure you grab the latest version
curl -OL https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip
# Unzip
unzip protoc-3.2.0-linux-x86_64.zip -d protoc3
# Move protoc to /usr/local/bin/
sudo mv protoc3/bin/* /usr/local/bin/
# Move protoc3/include to /usr/local/include/
@dkarchmer
dkarchmer / django_request_factory_test.py
Last active September 20, 2023 06:19
Sample code for using RequestFactory to do Django Unit Testing - Get and Post
from django.test import TestCase, RequestFactory
from django.utils.importlib import import_module
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from django.contrib.sessions.middleware import SessionMiddleware
from django.contrib.messages.middleware import MessageMiddleware
from rest_framework import status
from .models import *