Skip to content

Instantly share code, notes, and snippets.

Miao ZhiCheng hellwolf

Block or report user

Report or block hellwolf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:e31f603f87cb0fa30b9a212d24ffdc03
### Keybase proof
I hereby claim:
* I am hellwolf on github.
* I am hellwolf (https://keybase.io/hellwolf) on keybase.
* I have a public key ASDp-pJdZFPC_pAoE-6UzzywqGo1frs3weSoDhzHVwEy0wo
To claim this, I am signing this object:
@hellwolf
hellwolf / IRToken.sol
Created Oct 18, 2019
IRToken.sol for remix editor
View IRToken.sol
// File: contracts/RTokenStructs.sol
pragma solidity ^0.5.8;
contract RTokenStructs {
/**
* @notice Global stats
*/
struct GlobalStats {
View rtoken-snippet.sol
/**
* @notice Sender supplies assets into the market and receives rTokens in exchange
* @param mintAmount The amount of the underlying asset to supply
* @return uint 0=success, otherwise a failure
*/
function mint(uint256 mintAmount) external returns (bool);
/**
* @notice Sender redeems rTokens in exchange for the underlying asset
* @param redeemTokens The number of rTokens to redeem into underlying
View cDAI.sol
pragma solidity >=0.4.21 <0.6.0;
// converted from cDAI.json
contract cDAI {
function name() external returns (
string memory
);
function approve(
address spender,
@hellwolf
hellwolf / abi-to-sol.js
Last active Jul 28, 2019
Convert ABI to solidity file
View abi-to-sol.js
/**
* Convert ABI json file to solidity interface contract
*/
const fs = require('fs');
const args = process.argv.slice(2);
function convert(inputFilename) {
const abi = JSON.parse(fs.readFileSync(inputFilename, 'utf8'));
View mail.php
<?php
$SECRET = '....';
header("Content-type: application/json");
if ($_GET["secret"] != $SECRET) {
http_response_code(401);
echo json_encode(array(
"success" => false,
"status_code" => 401
@hellwolf
hellwolf / test-ecdh1-derive.sh
Created Apr 7, 2019
test ecdh1 derive mechanism
View test-ecdh1-derive.sh
#!/bin/bash
openssl pkeyutl -derive -inkey new-secp384r1-private-key.pem -peerkey XXXXXXXX-pin1-public-key.pem | xxd -p | tr '\n' '|' | sed 's/|//g'
echo
pkcs11-tool --derive --token-label PIN1 --login --id 01 -m ECDH1-DERIVE --input-file new-secp384r1-public-key.der --output-file >(xxd -p | tr '\n' '|' | sed 's/|//g')
@hellwolf
hellwolf / gen-secp384r1-keypairs.sh
Created Apr 7, 2019
Generate secp384r1 key pairs
View gen-secp384r1-keypairs.sh
openssl ecparam -name secp384r1 -genkey -noout -out new-secp384r1-private-key.pem
openssl ec -in new-secp384r1-private-key.pem -pubout -outform DER -out new-secp384r1-public-key.der
@hellwolf
hellwolf / eesti-same-birthday.sh
Last active Oct 25, 2019
Estonian residents of the same birthday
View eesti-same-birthday.sh
YOUR_BIRTHDAY=YYMMDD;for a in 3 4;do
for i in `seq 9999`;do
kood=${a}${YOUR_BIRTHDAY}$(printf %04d $i)
# https://www.sk.ee/en/repository/ldap
found=$(ldapsearch -x -H ldaps://esteid.ldap.sk.ee -b c=EE "(serialNumber=PNOEE-$kood)" | sed -n 's/cn::\? \(.*\)$/\1/p' | uniq)
[ -z "${found%%*=}" ] && found=`echo $found|base64 -d`;[ ! -z "$found" ] && echo $kood $found;
done;
done
@hellwolf
hellwolf / truffle-minimize.sh
Created Feb 19, 2019
Truffle minimize json artifacts
View truffle-minimize.sh
#!/usr/bin/env bash
# Notes:
# - Shchema: https://github.com/trufflesuite/truffle/tree/develop/packages/truffle-contract-schema
# - bytecode vs deployedBytecode: https://ethereum.stackexchange.com/questions/32234/difference-between-bytecode-and-runtime-bytecode
for i in "$1"/*.json;do
[ -z "${i%%*.min.json}" ] && continue # already minified
m=${i%%.json}.min.json
echo "Minimizing truffle json artifact: $i"
echo "Original size: $(wc -c "$i")"
You can’t perform that action at this time.