Skip to content

Instantly share code, notes, and snippets.

Avatar
🐛
💯 💯 💩 😆 🐢

Duke Nguyen vanduc1102

🐛
💯 💯 💩 😆 🐢
View GitHub Profile
View steps.sh
INSTANCE_NAME=nucleus-jumphost-570
PORT=8080
REGION=us-west4
ZONE=us-west4-a
FIREWALL_RULE=allow-tcp-rule-698
# setup
gcloud config set compute/zone $ZONE
gcloud config set compute/region $REGION
@vanduc1102
vanduc1102 / HOFSampleToro.java
Created Oct 6, 2022
Java Higher Order Function sample
View HOFSampleToro.java
package com.pragmatists.blog.events.application;
import java.util.Random;
import java.util.function.Function;
import java.util.function.Supplier;
public class HOFSampleToro {
public static void main(String[] args) {
@vanduc1102
vanduc1102 / spotless-pom.xml
Last active Aug 9, 2022
google code format with spotless
View spotless-pom.xml
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.24.0</version>
<configuration>
<formats>
<format>
<includes>
<include>*.md</include>
<include>.gitignore</include>
@vanduc1102
vanduc1102 / api.http
Created Mar 2, 2022
How to upload file to PreSignedUrl with vscode REST Client
View api.http
@baseUrl = {{$dotenv SERVICE_API_ENDPOINT}}
@accessToken = {{$dotenv SERVICE_API_ACCESS_TOKEN}}
### Health-check
GET {{baseUrl}}/health
### Media
### Create media upload url
## This endpoint return a JSON { data : "signedUrl" }
View helper.ts
const NUMERALS = [
{ value: 1000000000000000000000, str: 'sextillion' },
{ value: 1000000000000000000, str: 'quintillion' },
{ value: 1000000000000000, str: 'quadrillion' },
{ value: 1000000000000, str: 'trillion' },
{ value: 1000000000, str: 'billion' },
{ value: 1000000, str: 'million' },
{ value: 1000, str: 'thousand' },
{ value: 100, str: 'hundred' },
{ value: 90, str: 'ninety' },
View BEP20-PancakeToken.sol
// AVN TOKEN
pragma solidity ^0.6.12;
// SPDX-License-Identifier: MIT
interface IERC20 {
@vanduc1102
vanduc1102 / logger.ts
Last active Jul 3, 2021
Winston3 Logger with custom namespace
View logger.ts
const { LOG_LEVEL, APP_ENV } = process.env;
const logFormatter = APP_ENV === 'dev'
? format.combine(
winston.format.timestamp(),
winston.format.colorize(),
winston.format.printf((meta: any) => {
const { level, message, timestamp, namespace, stack, ...restMeta } = meta;
const displayNamespace = namespace ? `[${namespace}] -` : '';
const stackMessage = stack ? `\n${stack}` : '';
@vanduc1102
vanduc1102 / NFT.md
Created Jun 12, 2021
Ví dụ về NFT token
View NFT.md

Non-fungible token ( NFT)

ERC-721 Token

NTF Websites

Beeple | The First 5000 Days

View ERC20-Token-Sample.sol
// contracts/GLDToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract ERC20_Token_Sample is ERC20, ERC20Burnable {
constructor() ERC20("ERC20 Token Sample1", "Sample 1") {
@vanduc1102
vanduc1102 / content.js
Last active Dec 26, 2020
Jest testing DOM in Node
View content.js
const fetch = require('node-fetch');
async function getContent(url, originRequest) {
console.log('Getting content from: ', url);
const { redirectUrl } = originRequest.query;
const { host, ...remainingHeaders } = originRequest.headers;
return fetch(url, {
method: originRequest.method,
headers: { ...remainingHeaders},
rejectUnauthorized: false