Skip to content

Instantly share code, notes, and snippets.

View hoangtrung99's full-sized avatar
⚔️

Nguyễn Hoàng Trung hoangtrung99

⚔️
View GitHub Profile
@mmansoor
mmansoor / readme.md
Last active June 14, 2024 07:46
Export Metrics from CloudWatch to CSV

Export CloudWatch Metrics

This document outlines how to export CloudWatch Metrics to CSV.

Pre Reqs

  1. AWS CLI (Command Line Interface) from here
  2. jq is a lightweight and flexible command-line JSON processor from here

How to export

@tieppt
tieppt / config.h
Last active March 26, 2023 02:46
GMMK Pro & QMK: support Rotary Knob, VIA, turn off RGB when host is suspended
// path: qmk_firmware/keyboards/gmmk/pro/ansi/keymaps/viapro/config.h
#pragma once
#ifdef RGB_MATRIX_ENABLE
#define RGB_DISABLE_WHEN_USB_SUSPENDED true
#endif // RGB_MATRIX_ENABLE
@erdomke
erdomke / grapesjs.d.ts
Last active February 15, 2023 01:00
Grapes.js TypeScript Definitions
declare namespace Backbone {
class Model<T> {
constructor(attr?:T, opt?:any)
attributes : T
collection: Collection<this>
cid: string
get<K extends keyof T>(prop:K) : T[K]
set<K extends keyof T>(prop:K , val:T[K]) : void
defaults() : T
on(eventName: string, callback: (...args: any[]) => void)
@gaearon
gaearon / 00-README-NEXT-SPA.md
Last active June 9, 2025 05:45
Next.js SPA example with dynamic client-only routing and static hosting

Next.js client-only SPA example

Made this example to show how to use Next.js router for a 100% SPA (no JS server) app.

You use Next.js router like normally, but don't define getStaticProps and such. Instead you do client-only fetching with swr, react-query, or similar methods.

You can generate HTML fallback for the page if there's something meaningful to show before you "know" the params. (Remember, HTML is static, so it can't respond to dynamic query. But it can be different per route.)

Don't like Next? Here's how to do the same in Gatsby.

@hoangtrung99
hoangtrung99 / axios.ts
Last active April 10, 2025 06:02
axios instance handle refresh token
import axios, { type AxiosError, type InternalAxiosRequestConfig, type AxiosResponse } from 'axios'
/**
* Create axios instance with default configuration
*/
const request = axios.create({
baseURL: import.meta.env.VITE_API_URL,
timeout: 5000
})