Skip to content

Instantly share code, notes, and snippets.

View vishwanath79's full-sized avatar

Vishwanath Subramanian vishwanath79

View GitHub Profile
@vishwanath79
vishwanath79 / merkle_sample.py
Last active July 4, 2021 16:48
Merkle Tree Example
from csv import reader
from hashlib import sha512
import sys
# Simple merkle tree example
# Invoke the script by calling "python merkle_sample.py "file1.csv" "file2.csv" to compare two merkle trees
class Merkle:
def __init__(self, file):
self.file = file
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/python
# -*- coding: utf-8 -*-
from keras.callbacks import EarlyStopping, ModelCheckpoint
save_early_callback = EarlyStopping(monitor='val_loss', patience=5)
save_best_callback = \
ModelCheckpoint('/content/model-{epoch:02d}-{val_accuracy:.2f}.f5'
, save_best_only=True, save_weights_only=True)
model.fit(
#!/usr/bin/python
# -*- coding: utf-8 -*-
from keras.callbacks import EarlyStopping
save_early_callback = EarlyStopping(monitor='val_loss', min_delta=0,
patience=3, verbose=1,
restore_best_weights=True)
model.fit(
X_train,
y_train,
batch_size=64,
#!/usr/bin/python
# -*- coding: utf-8 -*-
save_best_callback = tf.keras.callbacks.ModelCheckpoint(
'content/model-{epoch:02d}-{val_acc:.2f}.f5',
monitor='val_accuracy',
verbose=1,
save_best_only=True,
save_weights_only=False,
save_freq=100,
)
# bully algorithm sample /no sockets
import random
def resurrect(x):
if running[x] == 1:
print("Leader is running")
return
print("node ", x, " back to life")
running[x] = 1
#%%
import numpy as np
import pandas as pd
data = pd.read_csv("preprocessed_data.csv")
data = data.sample(frac=1)
train_size = int(0.8 * len(data))
features = data.drop(columns=["Price"])
targets= data["Price"]
X_train, X_test = features.values[:train_size, :], features.values[train_size:,:]
@vishwanath79
vishwanath79 / installing_cassandra.md
Created March 8, 2018 07:16 — forked from hkhamm/installing_cassandra.md
Installing Cassandra on Mac OS X

Installing Cassandra on Mac OS X

Install Homebrew

Homebrew is a great little package manager for OS X. If you haven't already, installing it is pretty easy:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"