This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import matplotlib.animation as animation | |
import copy | |
class Particle(object): | |
def __init__(self, position, velocity): | |
self.position = copy.copy(position) | |
self.velocity = copy.copy(velocity) | |
self.best_position = copy.copy(position) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gym | |
import time | |
from multiprocessing import Process, Pipe | |
import numpy as np | |
class EnvWorker(Process): | |
def __init__(self, env_name, pipe, name=None, NotDisplay=True, delay=0): | |
Process.__init__(self, name=name) | |
self.env = gym.make(env_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am yazzyyaz on github. | |
* I am yazanator (https://keybase.io/yazanator) on keybase. | |
* I have a public key ASBU-_BS2dPw4QzFP9JinhMy3roSsbTXqdgU5WspddP3rgo | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:latest | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
build-essential \ | |
ca-certificates \ | |
cmake \ | |
curl \ | |
git \ | |
pkg-config \ | |
gcc-arm-linux-gnueabihf \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with double_entry_book as ( | |
select to_address as address, value as value, block_timestamp | |
-- debits | |
from `bigquery-public-data.ethereum_blockchain.traces` | |
where to_address is not null | |
and status = 1 | |
and (call_type not in ('delegatecall', 'callcode', 'staticcall') or call_type is null) | |
union all | |
-- credits | |
select from_address as address, -value as value, block_timestamp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#standardSQL | |
-- MIT License | |
-- Copyright (c) 2019 Yaz Khoury, yaz.khoury@gmail.com | |
WITH block_rows AS ( | |
SELECT *, ROW_NUMBER() OVER (ORDER BY timestamp) AS rn | |
FROM `bigquery-public-data.crypto_ethereum_classic.blocks` | |
), | |
delta_time AS ( | |
SELECT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#standardSQL | |
WITH total_reward_book AS ( | |
SELECT miner, | |
DATE(timestamp) as date, | |
COUNT(miner) as total_block_reward | |
FROM `bigquery-public-data.crypto_ethereum_classic.blocks` | |
GROUP BY miner, date | |
), | |
total_reward_book_by_date AS ( | |
SELECT date, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- MIT License | |
-- Copyright (c) 2019 Yaz Khoury, yaz.khoury@gmail.com | |
WITH etc_transactions_book AS ( | |
SELECT TIMESTAMP_TRUNC(timestamp, DAY) AS etc_block_day, | |
SUM(transaction_count) AS etc_total_daily_transaction_count | |
FROM `bigquery-public-data.crypto_ethereum_classic.blocks` | |
GROUP BY TIMESTAMP_TRUNC(timestamp, DAY) | |
), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#standardSQL | |
-- MIT License | |
-- Copyright (c) 2019 Yaz Khoury, yaz.khoury@gmail.com | |
WITH miner_transaction_book AS ( | |
SELECT miner, | |
DATE(timestamp) AS date, | |
SUM(transaction_count) AS total_mined_transactions | |
FROM `bigquery-public-data.crypto_ethereum_classic.blocks` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH greater_than_million AS ( | |
SELECT TIMESTAMP_TRUNC(timestamp, DAY) AS block_day, | |
COUNT(*) AS gtm_blocks_mined | |
FROM `bigquery-public-data.crypto_ethereum_classic.blocks` | |
WHERE gas_used > 1000000 | |
GROUP BY block_day | |
), | |
total_blocks AS ( | |
SELECT TIMESTAMP_TRUNC(timestamp, DAY) AS day, | |
COUNT(*) AS total_blocks_mined |
OlderNewer