Skip to content

Instantly share code, notes, and snippets.

View htdangkhoa's full-sized avatar
💪
Every problem has more than one way to solve it.

Huỳnh Trần Đăng Khoa htdangkhoa

💪
Every problem has more than one way to solve it.
View GitHub Profile
@htdangkhoa
htdangkhoa / mila_api_scratchpad.py
Created January 8, 2024 06:41 — forked from sanghviharshit/mila_api_scratchpad.py
Scratch pad for working with Milacares API for monitoring and controlling Mila air purifier. Read my blog post for more details - https://blog.sanghviharshit.com/reverse-engineering-private-api-ssl-pinning/
# Scratch pad for working with Milacares API for monitoring and controlling their air purifier devices.
# Based on the code from https://www.stefaanlippens.net/oauth-code-flow-pkce.html for PKCE code verifier and challenge.
import base64
import hashlib
import html
import json
import os
import re
import urllib.parse
@htdangkhoa
htdangkhoa / Nework_throttling_profiles.md
Created July 6, 2023 03:55 — forked from theodorosploumis/Nework_throttling_profiles.md
Web development - Custom network throttling profiles
Profile download (kb/s) upload (kb/s) latency (ms)
Native 0 0 0
GPRS 50 20 500
56K Dial-up 50 30 120
Mobile EDGE 240 200 840
2G Regular 250 50 300
2G Good 450 150 150
3G Slow 780 330 200
@htdangkhoa
htdangkhoa / docker-compose.yml
Created March 7, 2022 14:11 — forked from pantsel/docker-compose.yml
example docker-compose.yml for kong, postgres and konga
version: "3"
networks:
kong-net:
driver: bridge
services:
#######################################
# Postgres: The database used by Kong
@htdangkhoa
htdangkhoa / redirects-in-react-router-v6.md
Created November 6, 2021 17:25 — forked from mjackson/redirects-in-react-router-v6.md
Notes on handling redirects in React Router v6, including a detailed explanation of how this improves on what we used to do in v4 and v5

Redirects in React Router v6

An important part of "routing" is handling redirects. Redirects usually happen when you want to preserve an old link and send all the traffic bound for that destination to some new URL so you don't end up with broken links.

The way we recommend handling redirects has changed in React Router v6. This document explains why.

Background

In React Router v4/5 (they have the same API, you can read about why we had to bump the major version here) we had a <Redirect> component that you could use to tell the router when to automatically redirect to another URL. You might have used it like this:

https://www.facebook.com/sharer.php?u={url}
https://www.facebook.com/dialog/share?app_id={app_id}&display={page_type}&href={url}&redirect_uri={redirect_url}
https://reddit.com/submit?url={url}&title={title}
https://twitter.com/intent/tweet?url={url}&text={title}&via={user_id}&hashtags={hash_tags}
https://www.linkedin.com/sharing/share-offsite/?url={url}
https://api.whatsapp.com/send?phone={phone_number}&text={title}%20{url}
https://www.tumblr.com/widgets/share/tool?canonicalUrl={url}&title={title}&caption={text}&tags={hash_tags}
http://pinterest.com/pin/create/button/?url={url}
https://www.blogger.com/blog-this.g?u={url}&n={title}&t={text}
https://www.evernote.com/clip.action?url={url}&title={title}
@htdangkhoa
htdangkhoa / js-expired-token.js
Created August 19, 2020 06:51 — forked from paulnguyen-mn/js-expired-token.js
Xử lý expired token trong javascript (js nâng cao)
// Easy Frontend
// Học FE đơn giản, dễ hiểu và đặc biệt phải vui ❤️
// JS NÂNG CAO - Xử lý expired token trong Javascript như thế nào?
// ❓ Chuyện gì xảy ra nếu giữa chừng token bị expired?
// Ví dụ: 3 api requests đồng thời với nhau
// TRƯỜNG HỢP 1: Token chưa expired, vẫn còn tốt chán 🤣
// --request 1-->
@htdangkhoa
htdangkhoa / jwtRS256.sh
Created January 3, 2020 03:53 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub