Skip to content

Instantly share code, notes, and snippets.

View yhuag's full-sized avatar
:octocat:
BUIDL

HU Yao-Chieh yhuag

:octocat:
BUIDL
View GitHub Profile
import torch
import torch.nn as nn
import torchvision.datasets as dsets
import torchvision.transforms as transforms
from torch.autograd import Variable
import sys, codecs
if sys.version_info[0] < 3:
import got
else:
import got3 as got
def main():
try:
tweetCriteria = got.manager.TweetCriteria().setQuerySearch('bitcoin').setSince("2015-01-01").setUntil("2015-12-31").setTopTweets(True)
pragma solidity ^0.4.13;
contract Sample {
uint public a = 0;
function Sample() public {
a = 10;
}
}
pragma solidity ^0.4.18;
// import "./EIP20Interface.sol";
import "github.com/ConsenSys/Tokens/contracts/eip20/EIP20Interface.sol";
contract EIP20 is EIP20Interface {
uint256 constant private MAX_UINT256 = 2**256 - 1;
mapping (address => uint256) public balances;
pragma solidity ^0.4.8;
// ----------------------------------------------------------------------------------------------
// Sample fixed supply token contract
// Enjoy. (c) BokkyPooBah 2017. The MIT Licence.
// ----------------------------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/issues/20
contract ERC20Interface {
@yhuag
yhuag / hi
Last active April 10, 2018 10:38
input: 1.2, 3.4, 2.1, 5
a: 1 2 3 4 5
1 1 1 1
1 2 3 4 5
sum: 4 3 2 1 1
max: 4
@yhuag
yhuag / pin_break.py
Created April 23, 2018 09:31
pin demonstration
import os
def testChar(_char):
os.system("echo '"+_char+"' | ../../../pin -t obj-intel64/inscount0.so -- ~/Downloads/break")
def getInstr():
return os.popen("cat inscount.out").read()
ascii_list = [chr(x) for x in range(48,127)]
ans = ""
pragma solidity ^0.4.21;
// @title MAR mode: Module-Agnostic Rendering Mode (Core)
// @author Jeff Hu
// @dev This smart contract is modularized via a module agnostic execution scheme
contract C {
address public M_addr; // The deployed address of the module M
string public M_func; // The target function signature of module M
pragma solidity ^0.4.21;
// @title MAR mode: Module-Agnostic Rendering Mode (Module)
// @author Jeff Hu
// @dev This smart contract is an atomic callable stub
contract M {
bool public value = false;
function setTrue() public {
value = true;
@yhuag
yhuag / Gating.sol
Created July 1, 2018 11:58
Modularized smart contract: Gating
pragma solidity ^0.4.24;
// @title Modularized smart contract: Gating
// @author Hu Yao-Chieh (yhuag@ust.hk)
// @dev This smart contract is modularized by switching on/off a specific module via modifier access control mapping.
contract Gating {
address owner;
mapping (uint => bool) public enabled;
// Constructor