Skip to content

Instantly share code, notes, and snippets.

View alexvandesande's full-sized avatar
🤖
Preventing human machine conflicts

Alex Van de Sande alexvandesande

🤖
Preventing human machine conflicts
View GitHub Profile
@alexvandesande
alexvandesande / README.md
Last active August 29, 2015 14:07 — forked from mbostock/.block
Ethereum User Surveys

This is a force directed graph using user data surveys from /r/ethereum expressing their interests. This is a fork of the Les Miserables graph by mbostock


A physical simulation of charged particles and springs places related characters in closer proximity, while unrelated characters are farther apart. Layout algorithm inspired by Tim Dwyer and Thomas Jakobsen. Data based on character coappearence in Victor Hugo's Les Misérables, compiled by Donald Knuth.

Compare this display to a force layout with curved links, a force layout with fisheye distortion and a matrix diagram.

@alexvandesande
alexvandesande / Democratic Autonomous Organisation
Created November 26, 2015 17:31
Democratic Autonomous Organisation in Ethereum
/*
This creates a Democractic Autonomous Organization. Membership is based
on ownership of custom tokens, which are used to vote on proposals.
This contract is intended for educational purposes, you are fully responsible
for compliance with present or future regulations of finance, communications
and the universal rights of digital beings.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
Uses Mist Coin for voting: 0xf4eced2f682ce333f96f2d8966c613ded8fc95dd
Owns 100,000 Mist coins for further distribution of funds
ADDRESS:
0x8d554c6c1631e44706e502433f0f958287d9b8dc
INTERFACE:
Address: 0xdbf03b407c01e7cd3cbea99509d93f8dddc8c6fb
ABI:
[ { "constant": true, "inputs": [ { "name": "", "type": "uint256", "typeShort": "uint", "bits": "256", "displayName": "", "template": "elements_input_uint", "value": "" } ], "name": "proposals", "outputs": [ { "name": "recipient", "type": "address" }, { "name": "amount", "type": "uint256" }, { "name": "description", "type": "string" }, { "name": "votingDeadline", "type": "uint256" }, { "name": "executed", "type": "bool" }, { "name": "proposalPassed", "type": "bool" }, { "name": "numberOfVotes", "type": "uint256" }, { "name": "currentResult", "type": "int256" }, { "name": "proposalHash", "type": "bytes32" } ], "type": "function", "displayName": "proposals" }, { "constant": false, "inputs": [ { "name": "proposalNumber", "type": "uint256", "typeShort": "uint", "bits": "256", "displayName": "proposal Number", "template": "elements_input_uint" }, { "name": "transactionBytecode", "type": "bytes", "typeShort": "bytes", "bits": "", "displayName": "tra
@alexvandesande
alexvandesande / How to interact with the Dogecoin Bounty DAO
Created December 29, 2015 12:00
This is a contract that manages bounties donated by the community to be donated to people who worked sucessfully on projects related to dogecoin-ethereum integration. It's a member vote.
This is a contract that manages bounties donated by the community to be donated to people who worked sucessfully on
projects related to dogecoin-ethereum integration. It's a member vote.
1) Download the latest Ethereum Wallet: https://github.com/ethereum/mist/releases/tag/0.3.7
2) Open it, let it sync and then create a new account
3) If you don't have any ether and isn't a member of the DAO, contact alex: avsa@ethdev.
4) Go to the 'contracts' tab and then 'watch contract'. Add the address and interface abi of the contract as shown here: https://gist.github.com/alexvandesande/eb6935702e2549d1e510
@alexvandesande
alexvandesande / Blockchain Congress
Created January 27, 2016 18:10
The way this particular democracy works is that it has an *Owner** which works like an administrator, CEO or a President. The *Owner* can add (or remove) voting members to the organization. Any member can make a proposal, which is in the form of an ethereum transaction to either send ether or execute some contract and other members can vote in s…
contract owned {
address public owner;
function owned() {
owner = msg.sender;
}
modifier onlyOwner {
if (msg.sender != owner) throw;
_
Address:
0x85935ee5773319756973cfd8ce5d3eb5831827ce
ABI:
[ { "constant": true, "inputs": [ { "name": "", "type": "uint256", "typeShort": "uint", "bits": "256", "displayName": "", "template": "elements_input_uint" } ], "name": "proposals", "outputs": [ { "name": "recipient", "type": "address", "value": "0xd1220a0cf47c7b9be7a2e6ba89f429762e7b9adb", "displayName": "recipient" }, { "name": "amount", "type": "uint256", "value": "10", "displayName": "amount" }, { "name": "description", "type": "string", "value": "Refund 10 ethers to Avsa as a test of the DAO", "displayName": "description" }, { "name": "votingDeadline", "type": "uint256", "value": "1454093006", "displayName": "voting Deadline" }, { "name": "executed", "type": "bool", "value": true, "displayName": "executed" }, { "name": "proposalPassed", "type": "bool", "value": true, "displayName": "proposal Passed" }, { "name": "numberOfVotes", "type": "uint256", "value": "1", "displayName": "number Of Votes" }, { "name": "currentResult", "type": "int256", "valu
@alexvandesande
alexvandesande / Random generator
Last active December 23, 2022 09:10
A very simple random generator. A miner can influence the number by not publishing a block with an unwanted outcome, and forfeiting the 5 block reward.
contract random {
/* Generates a random number from 0 to 100 based on the last block hash */
function randomGen(uint seed) constant returns (uint randomNumber) {
return(uint(sha3(block.blockhash(block.number-1), seed ))%100);
}
/* generates a number from 0 to 2^n based on the last n blocks */
function multiBlockRandomGen(uint seed, uint size) constant returns (uint randomNumber) {
uint n = 0;
for (uint i = 0; i < size; i++){
/*
Foundation Tip Contract
Address: 0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359
Bitcoin Shapeshift Address: 1GyczDXWjFbmhx2Qau4ham3zJqNEP8UcEG (if transaction fails it is sent to 39BaMQCphFXyYAvcoGpeKtnptLJ9v6cdFY instead)
Interface: [{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"proposals","outputs":[{"name":"recipient","type":"address"},{"name":"amount","type":"uint256"},{"name":"description","type":"string"},{"name":"votingDeadline","type":"uint256"},{"name":"executed","type":"bool"},{"name":"proposalPassed","type":"bool"},{"name":"numberOfVotes","type":"uint256"},{"name":"currentResult","type":"int256"},{"name":"proposalHash","type":"bytes32"}],"type":"function"},{"constant":false,"inputs":[{"name":"proposalNumber","type":"uint256"},{"name":"transactionBytecode","type":"bytes"}],"name":"executeProposal","outputs":[{"name":"result","type":"int256"}],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"memberId","outputs":[{"name":"","type":"uint
contract tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData); }
contract MyToken {
/* Public variables of the token */
string public name;
string public symbol;
uint8 public decimals;
/* This creates an array with all balances */
mapping (address => uint256) public balanceOf;