Skip to content

Instantly share code, notes, and snippets.

View sonthanhdan's full-sized avatar
🎯
Focusing

Son Thanh Dan sonthanhdan

🎯
Focusing
  • Ho Chi Minh City
  • 20:50 (UTC +07:00)
View GitHub Profile
@sonthanhdan
sonthanhdan / index.js
Created September 21, 2023 06:22 — forked from caesaneer/index.js
Part 2 - Worker Threads - Index.js
// ════════════════════════════════════════════════════════════════════════════════════════════════╡
const http = require('http')
const { StaticPool } = require('node-worker-threads-pool')
const numCPUs = require('os').cpus().length
// ════════════════════════════════════════════════════════════════════════════════════════════════╡
const host = '192.168.0.14'
const port = 8080
@sonthanhdan
sonthanhdan / nx-structure-angular-nestjs.md
Created September 21, 2023 06:21 — forked from trungvose/nx-structure-angular-nestjs.md
Nx workspace structure for NestJS and Angular

Nx

https://nx.dev/

Nx is a suite of powerful, extensible dev tools to help you architect, test, and build at any scale — integrating seamlessly with modern technologies and libraries while providing a robust CLI, caching, dependency management, and more.

It has first-class support for many frontend and backend technologies, so its documentation comes in multiple flavours.

Principles

@sonthanhdan
sonthanhdan / gitflow-breakdown.md
Created September 21, 2023 06:20 — forked from JamesMGreene/gitflow-breakdown.md
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@sonthanhdan
sonthanhdan / GetOptimizationStatus.md
Created September 21, 2023 06:19 — forked from justjavac/GetOptimizationStatus.md
V8 %GetOptimizationStatus

%GetOptimizationStatus return a set of bitwise flags instead of a single value, to access the value, you need to take the binary representation of the returned value. Now, for example, if 65 is returned, the binary representation is the following:

(65).toString(2).padStart(12, '0');
// 000001000001

Each binary digit acts as a boolean with the following meaning:

import sharp from "sharp";
import stream from "stream";
import { GetObjectCommand, S3Client } from "@aws-sdk/client-s3";
import { Upload } from "@aws-sdk/lib-storage";
const width = 400;
const prefix = `${width}w`;
const S3 = new S3Client({});
@sonthanhdan
sonthanhdan / bitbucket-reusable-pipelines.yml
Created June 4, 2023 15:24 — forked from prabhu/bitbucket-reusable-pipelines.yml
Reusable Bitbucket pipelines configuration with YAML anchors
definitions:
steps:
- step: &build
name: Build microservices jar
script:
- mvn package
artifacts:
- target/**
- step: &build-react
name: Build React app
;(function(){
let lagLevel = 0;
let elm = new Image();
let interval = setInterval(function(){
let startTime = new Date().getTime();
for(let i = 0; i < 1000; i++){
console.log('%c', elm);
console.clear();
}
let endTime = new Date().getTime();
services:
redis:
platform: linux/amd64 # for mac M1 chip
image: 'bitnami/redis:latest'
container_name: redis
restart: always
ports:
- '6379:6379'
environment:
{
"$schema": "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
"basics": {
"name": "Dan Son Thanh",
"label": "Software developer",
"image": "",
"email": "danst.dev@mail.com",
"phone": "(912) 555-4321",
"url": "http://danst.example.com",
"summary": "Richard hails from Tulsa. He has earned degrees from the University of Oklahoma and Stanford. (Go Sooners and Cardinal!) Before starting Pied Piper, he worked for Hooli as a part time software developer. While his work focuses on applied information theory, mostly optimizing lossless compression schema of both the length-limited and adaptive variants, his non-work interests range widely, everything from quantum computing to chaos theory. He could tell you about it, but THAT would NOT be a “length-limited” conversation!",
// calculate the number of IPs between the range of IP
const ipAddressConverter = {
isInRange: function(ip, from, to){
const fromRange = this.ip2int(from)
const toRange = this.ip2int(to)
const check = this.ip2int(ip)
return from < check && check < toRange
},
countInRange: function(from, to){