Skip to content

Instantly share code, notes, and snippets.

View oNddleo's full-sized avatar
🎯
Focusing

Nguyễn Đức Long oNddleo

🎯
Focusing
View GitHub Profile
@oNddleo
oNddleo / hard2softdelete.md
Created November 13, 2024 15:31
Different hard delete and soft delete

Let me break down the comparison between soft delete and hard delete in PostgreSQL, with specific contexts where each approach makes more sense.

Soft Delete vs Hard Delete in PostgreSQL - A Comprehensive Analysis

Soft Delete

@oNddleo
oNddleo / sync-account.go
Created November 13, 2024 15:12
Sync account template
package sync
import (
"context"
"database/sql"
"time"
)
// Account represents the account data structure
type Account struct {
@oNddleo
oNddleo / .wezterm.lua
Last active November 7, 2024 01:12
wezterm config
-- Pull in the wezterm API
local wezterm = require 'wezterm'
-- This table will hold the configuration.
local config = {}
-- In newer versions of wezterm, use the config_builder which will
-- help provide clearer error messages
if wezterm.config_builder then
config = wezterm.config_builder()
end
@oNddleo
oNddleo / rebalance.go
Created October 14, 2024 07:20
rebalance
package main
import (
"fmt"
"math"
)
// TickerAllocation represents a ticker symbol and its allocation percentage.
type TickerAllocation struct {
Ticker string
@oNddleo
oNddleo / readme.md
Created July 27, 2023 08:29 — forked from ihabhamad/readme.md
Jetbrains IntelliJ Activation Code

For Subsciption until January 10, 2020

CATF44LT7C-eyJsaWNlbnNlSWQiOiJDQVRGNDRMVDdDIiwibGljZW5zZWVOYW1lIjoiVmxhZGlzbGF2IEtvdmFsZW5rbyIsImFzc2lnbmVlTmFtZSI6IiIsImFzc2lnbmVlRW1haWwiOiIiLCJsaWNlbnNlUmVzdHJpY3Rpb24iOiJGb3IgZWR1Y2F0aW9uYWwgdXNlIG9ubHkiLCJjaGVja0NvbmN1cnJlbnRVc2UiOmZhbHNlLCJwcm9kdWN0cyI6W3siY29kZSI6IklJIiwicGFpZFVwVG8iOiIyMDIwLTAxLTA4In0seyJjb2RlIjoiQUMiLCJwYWlkVXBUbyI6IjIwMjAtMDEtMDgifSx7ImNvZGUiOiJEUE4iLCJwYWlkVXBUbyI6IjIwMjAtMDEtMDgifSx7ImNvZGUiOiJQUyIsInBhaWRVcFRvIjoiMjAyMC0wMS0wOCJ9LHsiY29kZSI6IkdPIiwicGFpZFVwVG8iOiIyMDIwLTAxLTA4In0seyJjb2RlIjoiRE0iLCJwYWlkVXBUbyI6IjIwMjAtMDEtMDgifSx7ImNvZGUiOiJDTCIsInBhaWRVcFRvIjoiMjAyMC0wMS0wOCJ9LHsiY29kZSI6IlJTMCIsInBhaWRVcFRvIjoiMjAyMC0wMS0wOCJ9LHsiY29kZSI6IlJDIiwicGFpZFVwVG8iOiIyMDIwLTAxLTA4In0seyJjb2RlIjoiUkQiLCJwYWlkVXBUbyI6IjIwMjAtMDEtMDgifSx7ImNvZGUiOiJQQyIsInBhaWRVcFRvIjoiMjAyMC0wMS0wOCJ9LHsiY29kZSI6IlJNIiwicGFpZFVwVG8iOiIyMDIwLTAxLTA4In0seyJjb2RlIjoiV1MiLCJwYWlkVXBUbyI6IjIwMjAtMDEtMDgifSx7ImNvZGUiOiJEQiIsInBhaWRVcFRvIjoiMjAyMC0wMS0wOCJ9LHsiY29kZSI6I

@oNddleo
oNddleo / camelCase.md
Last active July 12, 2023 03:31
Convert snake_case to camelCase in VS Code

Convert snake_case to camelCase in VS Code

  • Press CTRL-H ( ⌥⌘F on Mac ).
  • Press ALT-R ( ⌥⌘R on Mac ).
  • Type _([a-zA-Z]).
  • Press TAB and type $1.
  • Press ALT-ENTER ( ⌥ENTER on Mac ).
  • Press F1 and type upper, then press ENTER.
  • Press CTRL-ALT-ENTER ( ⌥⌘ENTER on Mac ).
@oNddleo
oNddleo / race-condition.go
Created June 26, 2023 09:39
Race Condition With Bank Deposit and Withdraw Example
package main
import (
"fmt"
"sync"
)
var (
balance int
)
@oNddleo
oNddleo / merged-channel.go
Created June 26, 2023 09:33
Merged Channel Example
package main
import (
"fmt"
"sync"
)
func streamNumbers(numbers ...int) <-chan int {
c := make(chan int)
@oNddleo
oNddleo / loadbalancing-channel.go
Last active June 26, 2023 09:33
Load Balancing Channel Example
package main
import (
"fmt"
"sync"
)
func publisher() <-chan int {
c := make(chan int)
@oNddleo
oNddleo / git-ssh-error-fix.sh
Created June 22, 2023 07:37 — forked from Tamal/git-ssh-error-fix.sh
Solution for 'ssh: connect to host github.com port 22: Connection timed out' error
$ git clone [email protected]:xxxxx/xxxx.git my-awesome-proj
Cloning into 'my-awesome-proj'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
$ # This should also timeout
$ ssh -T [email protected]
ssh: connect to host github.com port 22: Connection timed out
$ # but this might work