| use std::collections::HashMap; | |
| use std::fmt; | |
| use std::io; | |
| use std::num::ParseFloatError; | |
| /* | |
| Types | |
| */ | |
| #[derive(Clone)] |
In an effort to gain at least a superficial understanding of the technical implementation of cryptocurrencies, I recently worked my way through "Learn Blockchains by Building One" using Clojure.
This was a good chance to experiment with using spec in new ways. At work, we primarily use spec to validate our global re-frame state and to validate data at system boundaries. For this project, I experimented with using instrumentation much more pervasively than I had done elsewhere.
This is not a guide to spec (there are already many excellent resources for this). Rather, it's an experience report exploring what went well, what is still missing, and quite a few unanswered questions for future research. If you have solutions for any of the problems I've presented, please let me know!
You don't need to know or care about blockchains to understand the code be
A description of known problems in Satoshi Nakamoto's paper, "Bitcoin: A Peer-to-Peer Electronic Cash System", as well as notes on terminology changes and how Bitcoin's implementation differs from that described in the paper.
The longest chain not only serves as proof of the sequence of events witnessed, but proof that it came from the largest pool of CPU power.
| import gym | |
| import random | |
| import numpy as np | |
| import tensorflow as tf | |
| class DQN: | |
| REPLAY_MEMORY_SIZE = 10000 | |
| RANDOM_ACTION_PROB = 0.5 | |
| RANDOM_ACTION_DECAY = 0.99 |
| # ------------------------------- | |
| # DQN for CartPole in OpenAI Gym | |
| # Author: Flood Sung | |
| # Date: 2016.6.27 | |
| # All rights reserved | |
| # ------------------------------- | |
| import gym | |
| import tensorflow as tf | |
| import numpy as np |
| """ Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """ | |
| import numpy as np | |
| import cPickle as pickle | |
| import gym | |
| # hyperparameters | |
| H = 200 # number of hidden layer neurons | |
| batch_size = 10 # every how many episodes to do a param update? | |
| learning_rate = 1e-4 | |
| gamma = 0.99 # discount factor for reward |
brew install unison
sudo pip install macfsevents
curl https://raw.githubusercontent.com/jumpstarter-io/unox/master/unox.py |sudo tee /usr/local/bin/unison-fsmonitor >/dev/null
sudo chmod +x /usr/local/bin/unison-fsmonitor
Edward Snowden answered questions after a showing of CITIZENFOUR at the IETF93 meeting; this is a transcript of the video recording.
For more information, see the Internet Society article.