Skip to content

Instantly share code, notes, and snippets.

View murych's full-sized avatar
👑
I may be slow to respond.

Timur murych

👑
I may be slow to respond.
View GitHub Profile
@murych
murych / snakecoin-block.py
Created July 18, 2017 11:02 — forked from aunyks/snakecoin-block.py
The block structure for SnakeCoin.
import hashlib as hasher
class Block:
def __init__(self, index, timestamp, data, previous_hash):
self.index = index
self.timestamp = timestamp
self.data = data
self.previous_hash = previous_hash
self.hash = self.hash_block()
import datetime as date
def create_genesis_block():
# Manually construct a block with
# index zero and arbitrary previous hash
return Block(0, date.datetime.now(), "Genesis Block", "0")
def next_block(last_block):
this_index = last_block.index + 1
this_timestamp = date.datetime.now()
this_data = "Hey! I'm block " + str(this_index)
this_hash = last_block.hash
return Block(this_index, this_timestamp, this_data, this_hash)
# Create the blockchain and add the genesis block
blockchain = [create_genesis_block()]
previous_block = blockchain[0]
# How many blocks should we add to the chain
# after the genesis block
num_of_blocks_to_add = 20
# Add blocks to the chain
for i in range(0, num_of_blocks_to_add):
import hashlib as hasher
import datetime as date
# Define what a Snakecoin block is
class Block:
def __init__(self, index, timestamp, data, previous_hash):
self.index = index
self.timestamp = timestamp
self.data = data
self.previous_hash = previous_hash
@murych
murych / rats_masses.R
Last active July 8, 2017 12:14
Сравнение масс органов крыс
library(ggplot2)
df <- read.csv("Intact VS Paracetamol Organs' Masses.csv")
plotbox <- function(organ, name, start = 0, stop = 5, step = 1){
boxplot <- ggplot(df, aes(x = Group, y = organ)) +
geom_boxplot(aes(fill = Group)) +
stat_boxplot(geom = "errorbar", width = 0.5) +
geom_jitter(shape = 2, alpha = 0.5) +
scale_fill_manual(values=c("#56B4E9", "#E69F00")) +
#include <vector>
#include <iostream>
template<typename T>
std::vector<T>
conv_valid(std::vector<T> const &f, std::vector<T> const &g){
int const nf = f.size();
int const ng = g.size();
std::vector<T> const &min_v = (nf < ng)? f : g;
std::vector<T> const &max_v = (nf < ng)? g : f;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Keybase proof

I hereby claim:

  • I am murych on github.
  • I am murych (https://keybase.io/murych) on keybase.
  • I have a public key ASCnIR7SIoC7E9bfEwNu0QfKEv_ILuBiG4HUEy0XIWUE 7Qo

To claim this, I am signing this object: