Skip to content

Instantly share code, notes, and snippets.

@yenthanh132
yenthanh132 / web3_testsign.js
Created January 22, 2022 09:38
Test Signing Message with Web3
async function testSign() {
let from = currentAccount;
let unixTime = new Date().getTime();
let params = [currentAccount + ":" + unixTime, from];
let method = 'personal_sign';
web3.currentProvider.sendAsync(
{
method,
params,
@yenthanh132
yenthanh132 / squid.md
Last active January 19, 2022 03:39
Setup Proxy for Ubuntu 18.04 with Squid in 5 minutes!

Install SQUID

sudo apt-get update
sudo apt-get install squid
sudo apt-get install apache2-utils

Setup AUTH:

sudo htpasswd /etc/squid/passwd newuser
@yenthanh132
yenthanh132 / godaddy_2step_pincode_bruteforce.go
Created October 8, 2018 04:12
Source code to brute force the pin code for Godaddy's 2-step authentication, written in Golang by Thanh Le
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
"math/rand"
"time"
)
@yenthanh132
yenthanh132 / mytoken4.js
Last active February 21, 2021 08:39
Advanced implementation for TOKEN based on ERC-20 Token standard
pragma solidity ^0.4.18;
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
@yenthanh132
yenthanh132 / erc20token.js
Created December 10, 2017 13:44
ERC-20 Token standard
// Referrals: https://github.com/ethereum/EIPs/issues/20
contract ERC20 {
function totalSupply() constant returns (uint totalSupply);
function balanceOf(address _owner) constant returns (uint balance);
function transfer(address _to, uint _value) returns (bool success);
function transferFrom(address _from, address _to, uint _value) returns (bool success);
function approve(address _spender, uint _value) returns (bool success);
function allowance(address _owner, address _spender) constant returns (uint remaining);
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
@yenthanh132
yenthanh132 / mytoken3.js
Last active May 24, 2018 16:58
Inheritance in smart contract
pragma solidity ^0.4.18;
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
@yenthanh132
yenthanh132 / mytoken2.js
Last active May 24, 2018 16:55
[ETHER101] Lession 3: Create a real Token in production with Ethereum
pragma solidity ^0.4.18;
contract MyBitcoin {
mapping (address => uint256) public balanceOf;
event Transfer(address indexed from, address indexed to, uint256 value);
function MyBitcoin(uint256 initialSupply) public{
balanceOf[msg.sender] = initialSupply;
}
@yenthanh132
yenthanh132 / mytoken1.js
Last active May 24, 2018 16:52
[Solidity] My Token - Simple
pragma solidity ^0.4.18;
contract MyBitcoin {
/* This creates an array with all balances */
mapping (address => uint256) public balanceOf;
/* Initializes contract with initial supply tokens to the creator of the contract */
function MyBitcoin(uint256 initialSupply) public {
balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens
}