Skip to content

Instantly share code, notes, and snippets.

Avatar
💭

vasa vasa-develop

💭
View GitHub Profile
@vasa-develop
vasa-develop / go-ipld-p2-4.go
Created Jan 22, 2020
SimpleAsWater Tutorial: Hands On IPLD Tutorial: PART 2
View go-ipld-p2-4.go
// GetDocument handles READ operations of a DAG entry by CID, returning the corresponding document
func GetDocument(ref, key string) (out SampleStruct, err error) {
err = sh.DagGet(ref+"/"+key, &out)
return
}
@vasa-develop
vasa-develop / Attack.sol
Created Jul 21, 2018
DO NOT USE THIS CODE. THIS CODE IS USED TO DEMONSTRATE A VULNERABILITY IN A SOLIDITY CODE.
View Attack.sol
import "EtherStore.sol";
contract Attack {
EtherStore public etherStore;
// intialise the etherStore variable with the contract address
constructor(address _etherStoreAddress) {
etherStore = EtherStore(_etherStoreAddress);
}
function pwnEtherStore() public payable {
// attack to the nearest ether
View dependencies.sh
//if something breaks, go to this file: https://github.com/jpmorganchase/quorum-examples/blob/master/vagrant/bootstrap.sh
# install build deps
sudo add-apt-repository ppa:ethereum/ethereum
sudo apt-get update
sudo apt install make
sudo apt install g++ -y
sudo apt-get install -y build-essential unzip libdb-dev libleveldb-dev libsodium-dev zlib1g-dev libtinfo-dev solc sysvbanner wrk software-properties-common default-jdk maven
//installing go
@vasa-develop
vasa-develop / EtherStore.sol
Created Jul 21, 2018
DO NOT USE THIS CODE. THIS CODE IS USED TO DEMONSTRATE A VULNERABILITY IN A SOLIDITY CODE.
View EtherStore.sol
contract EtherStore {
uint256 public withdrawalLimit = 1 ether;
mapping(address => uint256) public lastWithdrawTime;
mapping(address => uint256) public balances;
function depositFunds() public payable {
balances[msg.sender] += msg.value;
}
function withdrawFunds (uint256 _weiToWithdraw) public {
View wildcard-SSL-Cert.txt
./acme.sh --issue -d *.chaininmotion.com --dns \
--yes-I-know-dns-manual-mode-enough-go-ahead-please
./acme.sh --renew -d *.chaininmotion.com \
--yes-I-know-dns-manual-mode-enough-go-ahead-please
@vasa-develop
vasa-develop / SSL_CERT_Installer.txt
Last active Aug 21, 2020
ssl cert installer(ubuntu 16.04, apache2)
View SSL_CERT_Installer.txt
sudo apt-get update
sudo apt-get install apache2 -y
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python-certbot-apache -y
sudo certbot --apache -d ipfscloud.store -d www.ipfscloud.store
View aviondb-browser-example.html
<!--Using AvionDB in Browser-->
<!--IPFS CDN Link-->
<script src="https://cdn.jsdelivr.net/npm/ipfs/dist/index.min.js"></script>
<!--AvionDB CDN Link-->
<script src="https://unpkg.com/aviondb/dist/aviondb.min.js"></script>
<script type="text/javascript">
const runExample = async () => {
const ipfs = await window.Ipfs.create();
// Creates a db named "DatabaseName"
@vasa-develop
vasa-develop / aviondb-example.js
Created May 3, 2020
Using AvionDB with Node.js
View aviondb-example.js
// Import modules
const AvionDB = require("aviondb");
const IPFS = require("ipfs");
const ipfs = new IPFS();
const runExample = async () => {
await ipfs.ready;
// Creates a db named "DatabaseName"
const aviondb = await AvionDB.init("DatabaseName", ipfs);
@vasa-develop
vasa-develop / go-ipld-p2-5.go
Created Jan 22, 2020
SimpleAsWater Tutorial: Hands On IPLD Tutorial: PART 2
View go-ipld-p2-5.go
// Fetch the details by reading the DAG for key "inputKey"
fmt.Printf("READ: Reading the document details of employee by ID: \"%s\"\n", inputID)
start = time.Now()
document, err := GetDocument(cid, inputID)
elapsed = time.Since(start)
if err != nil {
fmt.Println(err)
}
fmt.Printf("READ: Salary of employee ID %s is %s\n", string(inputID), string(document.Salary))
@vasa-develop
vasa-develop / go-ipld-p2-3.go
Created Jan 22, 2020
SimpleAsWater Tutorial: Hands On IPLD Tutorial: PART 2
View go-ipld-p2-3.go
// Map the struct instance to the mapping
DocStoreMap[inputID] = employeeObject
// Converting the map into JSON object
entryJSON, err := json.Marshal(DocStoreMap)
if err != nil {
fmt.Println(err)
}
// Display the marshaled JSON object before sending it to IPFS