Skip to content

Instantly share code, notes, and snippets.

View aldy505's full-sized avatar
๐Ÿ…

Reinaldy Rafli aldy505

๐Ÿ…
View GitHub Profile
@aldy505
aldy505 / networking_fix_wsl2.ps1
Created December 14, 2021 04:16
Dropping in here in case there's another error on networking in my WSL2
# Shutdown WSL first
wsl --shutdown --verbose
# Check it with list
wsl --list --verbose
# Open Powershell in administrator mode, then do:
New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action Allow
Get-Service LxssManager | Restart-Service
@aldy505
aldy505 / benchmark_result.md
Created December 11, 2021 10:50
A benchmark between Polka (Nodejs) with Jaguar (Dart)

TLDR: Polka won.

http://localhost:5000 is Jaguar. http://localhost:4000 is Polka.

โฏ hyperfine --warmup 2 --min-runs 500 \
> 'curl --request GET \
>   --url http://localhost:5000/ \
>   --header "Accept: application/json" \
>   --header "Content-Type: application/json" \
@aldy505
aldy505 / 14_days.js
Last active December 6, 2021 08:03
A port of my Go's 14 days challenge into Javascript
// Hello again. This time, we will be exploring the
// Date class and object.
//
// The function that we'll make is pretty simple,
// we are going to have a date input, in the form (or type)
// of Date, then we'll add 14 days to it.
//
// But here's the tricky part:
// We'll skip satuday and sundays, so the entire 14 days
// should be on weekdays only, not on weekends.
@aldy505
aldy505 / 14_days.go
Created December 1, 2021 04:53
Simple exercise to play around with the time standard library
package main
import (
"fmt"
"time"
)
// Hello again. This time, we will be exploring the
// time standard library.
//
@aldy505
aldy505 / sql_builder.go
Last active December 1, 2021 10:12
Simple exercise for learning strings standard library and basic logic of builder query
package main
import (
"fmt"
"strings"
)
// Hello again, soldier.
//
// In today's episode, we are going to make a simple
@aldy505
aldy505 / db_migrator.go
Created November 25, 2021 16:05
Quick, simple, and straightforward database migrator in Go
package main
import (
"context"
"database/sql"
"log"
"net/url"
"os"
"strings"
"time"
@aldy505
aldy505 / coffee_machines.go
Created November 25, 2021 15:11
Simple yet annoying demonstration of concurrency stuffs in Go
package main
import (
"fmt"
"log"
"sync"
"time"
)
func main() {
@aldy505
aldy505 / fintech_company.go
Created November 25, 2021 14:11
A simple financial-technology company to learn more about structs and method in Go
// Now we're creating a fintech (financial technology) company
// that you can store money to and can buy stocks.
//
// Like the previous challenge (well, not really lol - more like a homework)
// we use struct and methods to do things. Now we'll kind of
// do the same thing.
package main
import (
"fmt"
@aldy505
aldy505 / coffee_shop.go
Created November 25, 2021 14:05
Simple coffee shop to learn about Golang structs & methods
// This is a coffee shop.
// We can order coffee and see the menu.
//
// The problem is that this coffee shop
// code is not complete yet.
//
// This is just to train your skills on
// dealing with structs, variables,
// array/slices, methods, and types.
//
@aldy505
aldy505 / main.test.js
Created October 11, 2021 17:14
go-jason!
const { test } = require('uvu')
const assert = require('uvu/assert')
const {main} = require('../src/parser')
test('1', () => {
const p = main('price lt 10000')
assert.equal(p, {
value: 'lt',
children: [
{