Skip to content

Instantly share code, notes, and snippets.

View socheatsok78's full-sized avatar
πŸ––
ΰΌΌ ぀ β—•_β—• ༽぀ is having a baby

Socheat Sok socheatsok78

πŸ––
ΰΌΌ ぀ β—•_β—• ༽぀ is having a baby
View GitHub Profile
@socheatsok78
socheatsok78 / Makefile
Created February 7, 2023 14:31 — forked from sighingnow/Makefile
Detect operating system in Makefile.
# Detect operating system in Makefile.
# Author: He Tao
# Date: 2015-05-30
OSFLAG :=
ifeq ($(OS),Windows_NT)
OSFLAG += -D WIN32
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
OSFLAG += -D AMD64
endif
@socheatsok78
socheatsok78 / README.md
Last active October 13, 2023 11:43
s6-overlay logging configuration

Logging

The log will be written to both /var/log/some-service as well as standard output.

The key is that s6-log reads in a whole "logging script" on the command line, and you can have multiple actions - here's the link to the manual.

S6_LOGGING_SCRIPT="T 1 n20 s1000000 T"
@socheatsok78
socheatsok78 / http-benchmark.md
Created November 13, 2022 05:34 — forked from denji/http-benchmark.md
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)
@socheatsok78
socheatsok78 / Public_Time_Servers.md
Created October 31, 2022 12:40 — forked from mutin-sa/Top_Public_Time_Servers.md
List of Top Public Time Servers

Google Public NTP [AS15169]:

time.google.com

time1.google.com

time2.google.com

time3.google.com

@socheatsok78
socheatsok78 / ConfigurationLoader.js
Last active October 27, 2022 08:11
A collection of useful Webpack `require.context` loaders.
// bootstrap.js
export function WebpackConfigLoader () {
const r = require.context('@/configs', false, /\.js$/, 'lazy')
const modules = WebpackRequireContextWrapper(r)
return ConfigurationLoader(modules)
}
// ConfigurationLoader.js
export function ConfigurationLoader (modules) {
return new Promise((resolve) => {
@socheatsok78
socheatsok78 / GoConcurrency.md
Created October 6, 2022 04:23 — forked from rushilgupta/GoConcurrency.md
Concurrency in golang and a mini Load-balancer

INTRO

Concurrency is a domain I have wanted to explore for a long time because the locks and the race conditions have always intimidated me. I recall somebody suggesting concurrency patterns in golang because they said "you share the data and not the variables".

Amused by that, I searched for "concurrency in golang" and bumped into this awesome slide by Rob Pike: https://talks.golang.org/2012/waza.slide#1 which does a great job of explaining channels, concurrency patterns and a mini-architecture of load-balancer (also explains the above one-liner).

Let's dig in:

Goroutines

@socheatsok78
socheatsok78 / headache.md
Created August 22, 2022 02:31 — forked from pbrisbin/headache.md
ZSH startup file headaches

Default behavior dictates the following order for ZSH startup files:

  • /etc/zshenv
  • ~/.zshenv
  • /etc/zprofile (if login shell)
  • ~/.zprofile (if login shell)
  • /etc/zshrc (if interactive)
  • ~/.zshrc (if interactive)
  • /etc/zlogin (if login shell)
  • ~/.zlogin (if login shell)
@socheatsok78
socheatsok78 / unixhttpc.go
Created August 3, 2022 15:15 — forked from teknoraver/unixhttpc.go
HTTP over Unix domain sockets in golang
package main
import (
"context"
"flag"
"fmt"
"io"
"net"
"net/http"
"os"
@socheatsok78
socheatsok78 / README-setup-tunnel-as-systemd-service.md
Created July 22, 2022 08:53 — forked from drmalex07/README-setup-tunnel-as-systemd-service.md
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward

README

Create a template service file at /etc/systemd/system/[email protected]. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target