Skip to content

Instantly share code, notes, and snippets.

View tuhuynh27's full-sized avatar

Tu Huynh tuhuynh27

View GitHub Profile
@tuhuynh27
tuhuynh27 / ContentView.swift
Last active March 11, 2024 10:04
cryptoBar
import Cocoa
import SwiftUI
class StatusBarController {
private var statusItem: NSStatusItem?
private var btcPrice: String = "Loading..."
private let binanceAPIURL = URL(string: "https://api.binance.com/api/v3/ticker/price?symbol=BTCUSDT")!
init() {
let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
@tuhuynh27
tuhuynh27 / sgvisa.md
Last active December 5, 2023 08:55
SG Visa

Hướng Dẫn Xin Visa Du Lịch từ Singapore

Chuẩn Bị Hồ Sơ

Khi bạn chuẩn bị hồ sơ xin visa du lịch từ Singapore, đảm bảo rằng bạn đã có đầy đủ các giấy tờ sau:

  • Hình thẻ (passport size)
  • Bank statement (3-6 tháng, download từ ibanking)
  • Payslips
  • Company letter (nếu không đi làm thì spouse's company letter, spouse's passport & marriage cert)
@tuhuynh27
tuhuynh27 / wise_crawl.js
Created May 19, 2023 09:21
Wise money rate crawler
const fromCurrency = searchParams.get('from') || 'SGD';
const toCurrency = searchParams.get('to') || 'VND';
let response;
async function getRate(fromCurrency, toCurrency) {
// Fetch the exchange rate from Wise
response = await fetch(`https://wise.com/gb/currency-converter/${fromCurrency.toLowerCase()}-to-${toCurrency.toLowerCase()}-rate?amount=1`);
// Extract the exchange rate from the response
const html = await response.text();
                                 +-----------------------------------------------------+
                                 |             Monitoring System(s)                    |
                                 |                                                     |
                                 |  +------------+  +------------+   +-------------+   |
                                 |  |  Grafana   |  | Prometheus |   |   Jenkins   |   |
                                 |  +------------+  +------------+   +-------------+   |
                                 |                                                     |
                                 |   Detects and generates alert messages              |
                                 +-----------------------------------------------------+

|

@tuhuynh27
tuhuynh27 / traveloka_flights.js
Created August 29, 2022 13:39
Traveloka Flights Crawl
function extractPrice(priceStr) {
const priceOne = priceStr.slice(0, -2)
const priceTwo = priceStr.slice(-2)
return parseFloat(priceOne + '.' + priceTwo)
}
function extractDayMonthYearFromString(str) {
const [day, month, year] = str.split('-')
return { day, month, year }
}
@tuhuynh27
tuhuynh27 / keva_replication_article.md
Last active May 30, 2022 09:52
Keva Replication Article
  • Background
    • What is replication and why we need it
      • Replication definition
      • How it helps
    • Master slave architecture
      • Overview
      • Why we use it? -> HA, scale read performance, simpler than multi read multi write
  • Master slave replication
    • A simplistic approach
  • List steps:
@tuhuynh27
tuhuynh27 / JSONPValidator.java
Created September 2, 2021 22:48
Validating JSONP callback function name in Java
package com.tuhuynh.tradebot;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.regex.Pattern;
public class Main {
private static final Map<String, Boolean> testMap = new HashMap<>();
@tuhuynh27
tuhuynh27 / debt.json
Last active May 11, 2022 11:30
Tu's debt data
{"debt":-0.004999999999881766,"logs":[{"date":"11/04/2021 11:46:55","num":-3.6,"reason":"cơm trưa","reporter":"Tú"},{"date":"11/02/2021 12:19:00","num":-4.8,"reason":"cơm trưa dbrr","reporter":"Tú"},{"date":"11/01/2021 22:35:10","num":6.5,"reason":"cơm trưa + vim","reporter":"Lâm"},{"date":"11/01/2021 20:54:40","num":1257.45,"reason":"tiền nhà","reporter":"Lâm"},{"date":"11/01/2021 20:51:51","num":-1278.5,"reason":"tiền nhà tháng 11","reporter":"Tú"},{"date":"10/31/2021 16:28:00","num":7.1,"reason":"cơm chiên","reporter":"Lâm"},{"date":"10/29/2021 19:56:42","num":-8.5,"reason":"cơm tối ấn đụ","reporter":"Tú"},{"date":"10/29/2021 17:58:38","num":7.1,"reason":"cơm sườn","reporter":"Lâm"},{"date":"10/29/2021 12:58:16","num":4.5,"reason":"cơm trưa hqua","reporter":"Lâm"},{"date":"10/26/2021 20:59:51","num":-12,"reason":"cơm tối","reporter":"Tú"},{"date":"10/26/2021 12:12:41","num":-4.8,"reason":"cơm trưa dbrr","reporter":"Tú"},{"date":"10/25/2021 11:30:20","num":8.1,"reason":"cơm trưa","reporter":"Lâm"},{"date":"
@tuhuynh27
tuhuynh27 / mini-compiler.ts
Last active May 18, 2021 03:57
"Mini Compiler"
const operators = ['=', '+', '-', '*', '/', '>', '<', '>=', '<=', '==', '!=']
function isOp(v: string) {
for (let i = 0; i < operators.length; i++) {
if (operators[i] == v) return true
}
return false
}
function isNum(v: any) {