Skip to content

Instantly share code, notes, and snippets.

View nhancv's full-sized avatar
🏠
Working from home

Nhan Cao nhancv

🏠
Working from home
View GitHub Profile
@nhancv
nhancv / video-station-language-injection.js
Created October 14, 2022 07:31 — forked from the-unsoul/video-station-language-injection.js
Inject a subtitle language into Synology - Video Station
(function() {
var synoLang;
var isSynoReady;
var additional = {
code : 'vie', // <== uses reference language list at the bottom and set the 'code' to the language you wanted
label: 'Tiếng Việt' // <== 'label' can be anything you wanted. i.e. if set to 'New lang 123' you will see 'New lang 123' in the list
}
@nhancv
nhancv / README.md
Created November 23, 2021 08:11
Smartcontract multicall
@nhancv
nhancv / AbiEncode.sol
Last active November 8, 2021 15:12
AbiEncode
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
contract AbiEncode {
function encode() public pure returns (bytes memory) {
uint[2] memory amounts = [uint(1e18), uint(99e18)];
bytes memory userData = abi.encode(0, amounts);
return userData;
}
@nhancv
nhancv / MockERC20.sol
Last active March 2, 2022 13:25
MockERC20
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract MockERC20 is ERC20 {
constructor(
string memory _name,
string memory _symbol,
@nhancv
nhancv / MockERC721.sol
Last active October 29, 2021 11:33
MockERC721
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract MockERC721 is ERC721 {
constructor(string memory _name, string memory _symbol) ERC721(_name, _symbol) {
mint(msg.sender, 0);
}
@nhancv
nhancv / MockERC1155.sol
Created October 16, 2021 12:52
MockERC1155
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
contract MockERC1155 is ERC1155 {
constructor() public ERC1155("https://nhancv.com/{id}.json") {
mint(msg.sender, 0, 1);
}
// SPDX-License-Identifier: GNU GENERAL PUBLIC LICENSE V3
pragma solidity =0.8.3;
contract WBNB {
string public name = "Wrapped BNB";
string public symbol = "WBNB";
uint8 public decimals = 18;
event Approval(address indexed src, address indexed guy, uint wad);
event Transfer(address indexed src, address indexed dst, uint wad);
@nhancv
nhancv / flutter_get_intl_string_by_key.dart
Created July 11, 2021 08:44
Flutter get intl message by key manually
String get btnSkip {
return Intl.message(
// fallback text
context.strings.btnSkip,
// lang key
name: 'btnSkip',
);
}
@nhancv
nhancv / intl_arb2csv.py
Last active July 10, 2021 16:43
Export flutter intl arb file to csv
# python3 intl_arb2csv.py
import csv
import json
import os
def qrepr(s):
"repr with double-quotes"
# make one symbol special that isn't treated special in a string, in
# this case '@'.
@nhancv
nhancv / TestPlayerRead.sol
Created June 28, 2021 07:49
Smart contract pagination for list
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
contract TestPlayerRead {
struct Player {
uint id;
}
Player[] public playerList;