Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
###
### my-script — does one thing well
###
### Usage:
### my-script <input> <output>
###
### Options:
### <input> Input file to read.
### <output> Output file to write. Use '-' for stdout.
// Note that this is not the production code
pragma solidity 0.5.6;
import "./IERC20.sol";
contract Wallet {
address internal token = 0x123...<hot_wallet_addr>;
address internal hotWallet = 0x321...<hot_wallet_addr>;
constructor() public {
@azanium
azanium / jwtRS512.sh
Last active May 15, 2024 18:03 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS512 key
ssh-keygen -t rsa -b 4096 -e SHA512 -f jwtRS512.key
# Don't add passphrase
openssl rsa -in jwtRS512.key -pubout -outform PEM -out jwtRS512.key.pub
cat jwtRS512.key
cat jwtRS512.key.pub
@Notfallen
Notfallen / BaseMonoretoCrowdsale.sol
Created April 26, 2018 23:34
BaseMonoretoCrowdsale.sol
pragma solidity ^0.4.19;
import "zeppelin-solidity/contracts/crowdsale/distribution/RefundableCrowdsale.sol";
import "zeppelin-solidity/contracts/crowdsale/validation/CappedCrowdsale.sol";
import "zeppelin-solidity/contracts/crowdsale/emission/MintedCrowdsale.sol";
import "./MonoretoToken.sol";
/**
* @title Base contract for Monoreto PreICO and ICO
@promentol
promentol / advancedlottery.sol
Created February 10, 2018 22:09
An Advance Lottery with advance number generator
//THIS CONTRACT IS CONSUMING A LOT OF GAS
//THIS CONTRACT IS ONLY FOR DEMONSTRATING HOW RANDOM NUMBER CAN BE GENERATED
//DO NOT USE THIS FOR PRODUCTION
pragma solidity ^0.4.8;
contract Lottery {
mapping (uint8 => address[]) playersByNumber ;
@lychees
lychees / GuessGame2.sol
Created January 12, 2018 13:29
GuessGame2.sol
pragma solidity ^0.4.19;
contract GuessGame2 {
mapping(address => uint) ans;
mapping(address => address) opp;
mapping(address => uint) bal;
address unmatched_player;
/**
* Constructs funcion.
pragma solidity ^0.4.15;
contract StringsAndBytes {
/* --- public variables for storing tests results */
string public lastTestStringResult; //
bytes32 public lastTestBytes32Result; //
bytes public lastTestBytesResult; // bytes: dynamically-sized byte array
bool public lastTestBoolResult; //
@SKempin
SKempin / Git Subtree basics.md
Last active March 20, 2025 21:04
Git Subtree basics

Git Subtree Basics

If you hate git submodule, then you may want to give git subtree a try.

Background

When you want to use a subtree, you add the subtree to an existing repository where the subtree is a reference to another repository url and branch/tag. This add command adds all the code and files into the main repository locally; it's not just a reference to a remote repo.

When you stage and commit files for the main repo, it will add all of the remote files in the same operation. The subtree checkout will pull all the files in one pass, so there is no need to try and connect to another repo to get the portion of subtree files, because they were already included in the main repo.

Adding a subtree

Let's say you already have a git repository with at least one commit. You can add another repository into this respository like this:

@ageyev
ageyev / ProofOfExistence.sol
Created July 11, 2016 09:31
This smartcontract is used to store documents text on the Ethereum blockchain and to get the document by document's hash (sha256).
/*
This smartcontract is used to store documents text on the Ethereum blockchain
and to get the document by document's hash (sha256).
*/
contract ProofOfExistence{
/* ---- Public variables: */
string public created;
@ageyev
ageyev / Verificator.sol
Created June 10, 2016 11:24
Smart contract for Ethereum's account owner verification using Cryptonomica.net notary verified OpenPGP public key
/*
Usage:
1. Account owner sends a request for verification, in this request he sends a fingerprint of his OpenPGP key stored on cryptonomica.net
2. This contracts sends back a string to sign
3. Accont owener signs this strign with his OpenPGP key and sends back to smartcontract.
4. Information about verification is public visible - who needs to check can download verified public key from cryptonomica.net and check if owner of stated Ehereum acconts is also known owner of verified OpenPGP key on cryptonomica.net
It's also possible to create a web-inerface using Cryptonomica's API like: