Skip to content

Instantly share code, notes, and snippets.

View alexpanasUCLA's full-sized avatar

Alex alexpanasUCLA

  • Moscow
View GitHub Profile
@alexpanasUCLA
alexpanasUCLA / block.js
Last active September 9, 2021 14:52
Block Class
const SHA256 = require('crypto-js/sha256');
class Block {
constructor(data){
this.hash = "",
this.height = 0,
this.body = data,
this.time = 0,
this.previousBlockHash = ""
}
@alexpanasUCLA
alexpanasUCLA / blockchain.js
Last active October 22, 2018 08:31
Blockchain class
class Blockchain {
// Method 1: Initiate, and store blockchain in LevelDB
constructor(){
this.chain = level('./blockchaindata');
this.chain.put(0,JSON.stringify(Block.genesisBlock()))
}
// Method 2: Add new block to LevelDB
@alexpanasUCLA
alexpanasUCLA / create-kubernetes-cluster-on-aws.sh
Created April 21, 2020 23:33 — forked from chapati23/create-kubernetes-cluster-on-aws.sh
Setup script to create a fresh kubernetes cluster on AWS with kops incl. all required AWS resources (S3 buckets, IAM etc.)
#!/bin/bash
# Prerequisites (macOS):
# - aws cli => to create AWS resources
# => pip install --upgrade --user awscli
# => aws configure
# - jq => to parse JSON results returned by the AWS CLI
# => brew install jq
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0;
// Defining parent contract
contract School {
// Declaring variable in the parent contract
string public school = "Shmorse School of Solidity";
@alexpanasUCLA
alexpanasUCLA / private_modifier_lesson.sol
Last active June 27, 2022 12:36
Private modifier lesson
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0;
contract check_private {
// Declaring private variable
uint private _number =2;
// Can you check what is private variable
// from the contract ?
@alexpanasUCLA
alexpanasUCLA / ownable.sol
Last active June 27, 2022 12:35
Ownable contract example.
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0;
contract Ownable
{
// Variable that maintains
// owner address
address private _owner;
// Sets the original owner of