Skip to content

Instantly share code, notes, and snippets.

View kokizzu's full-sized avatar

Kiswono Prayogo kokizzu

View GitHub Profile
@kokizzu
kokizzu / a-warning.md
Created April 10, 2021 13:36 — forked from spion/a-warning.md
C++ versus V8 versus luajit versus C benchmark - (hash) tables

Warning

This benchmark has been misleading for a while. It was originally made to demonstrate how JIT compilers can do all sorts of crazy stuff to your code - especially LuaJIT - and was meant to be a starting point of discussion about what exactly LuaJIT does and how.

As a result, its not indicative of what its performance may be on more realistic data. Differences can be expected because

  1. the text will not consist of hard-coded constants
@kokizzu
kokizzu / latency.txt
Created April 3, 2021 19:26 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
SELECT table,
formatReadableSize(sum(bytes)) as size,
min(min_date) as min_date,
max(max_date) as max_date
FROM system.parts
WHERE active
GROUP BY table
@kokizzu
kokizzu / main.go
Created March 18, 2021 18:46 — forked from qdm12/main.go
DNS over HTTPS server resolver under 300 lines of clean Go code
package main
import (
"bytes"
"context"
"errors"
"fmt"
"io/ioutil"
"log"
"net/http"
@kokizzu
kokizzu / upload.go
Last active January 22, 2021 13:48
File upload using pako.js deflate and golang, credits: gitlab.com/birowo/latihan
package main
import (
"fmt"
"io"
"net/http"
"os"
"github.com/rs/xid"
)
# network/dns not working?
# do not compress %TEMP%
# snap not working?
sudo apt-get update && sudo apt-get install -yqq daemonize dbus-user-session fontconfig
sudo daemonize /usr/bin/unshare --fork --pid --mount-proc /lib/systemd/systemd --system-unit=basic.target
exec sudo nsenter -t $(pidof systemd) -a su - $LOGNAME
@kokizzu
kokizzu / jwt_golang_example.go
Created September 12, 2020 10:45 — forked from thealexcons/jwt_golang_example.go
JSON Web Tokens in Go
package main
import (
"io/ioutil"
"log"
"strings"
"net/http"
"encoding/json"
"fmt"
"time"
@kokizzu
kokizzu / note.txt
Created May 17, 2020 21:20
YHWH <> AllahSWT
Daripada debat, disimpulkan saja, AllahSWT tidak sama dengan YHWH, YHWH bukanlah Allah SWT
Membandingkan tuhan masing-masing agama Abrahamaic (karena kekristenan menurut Mat5:17 dan islam (ayat?) mengaku menyempurnakan agama sebelumnya), barangkali ada yang mau menyanggah
Tuhan Yahudi itu YHWH, kitab-nya Tanakh (atau kalau di Alkitab, perjanjian lama)
Tuhan Kristen itu Yesus, yaitu penggenapan nubuat2/ramalan bahwa YHWH sendiri akan menjadi manusia untuk menyelamatkan semua yang percaya
Tuhan Islam itu Allah SWT, kitabnya Quran, yang ini lain sendiri karena katanya ayatnya disampaikan jibril secara langsung kepada nabi M
@kokizzu
kokizzu / resources.md
Last active December 21, 2022 20:48
The Way, Truth, and Life
@kokizzu
kokizzu / global.js
Created February 29, 2020 13:23
Global JS
function toDate( unix ) {
if( !unix ) return '';
if( unix<9876543210 ) unix *= 1000;
return (new Date( unix )).toISOString().substr( 0, 10 );
}
function toTime( unix ) {
if( !unix ) return '';
if( unix<9876543210 ) unix *= 1000;
return (new Date( unix )).toISOString().substr( 0, 19 ).replace( 'T', ' ' );