Skip to content

Instantly share code, notes, and snippets.

View YazzyYaz's full-sized avatar
💭
Coding 💻

Yaz Khoury YazzyYaz

💭
Coding 💻
View GitHub Profile
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)
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)
### 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:
@YazzyYaz
YazzyYaz / Dockerfile
Created January 10, 2019 15:33
Cross-Compiling Parity to ARMV7
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 \
@YazzyYaz
YazzyYaz / gini.sql
Created January 11, 2019 19:57
Gini Ethereum Sampled
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
@YazzyYaz
YazzyYaz / hashrate.sql
Last active February 5, 2019 22:27
Hashrate BigQuery for Ethereum Classic
#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
@YazzyYaz
YazzyYaz / miner_reward_daily_gini.sql
Last active February 6, 2019 14:36
Daily Block Reward Gini
#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,
-- 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)
),
#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`
@YazzyYaz
YazzyYaz / daily_mined_blocks.sql
Last active February 22, 2019 03:53
Daily Mined Blocks Ethereum Classic
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