Skip to content

Instantly share code, notes, and snippets.

@rgl
rgl / http-server-shutdown.go
Created December 23, 2020 07:02
go http server with graceful shutdown
package main
import (
"context"
"flag"
"log"
"net/http"
"os"
"os/signal"
"time"
@ityonemo
ityonemo / test.md
Last active September 18, 2026 19:35
Zig in 30 minutes

A half-hour to learn Zig

This is inspired by https://fasterthanli.me/blog/2020/a-half-hour-to-learn-rust/

Basics

the command zig run my_code.zig will compile and immediately run your Zig program. Each of these cells contains a zig program that you can try to run (some of them contain compile-time errors that you can comment out to play with)

@gekigek99
gekigek99 / get process tree pids.go
Last active September 4, 2024 21:13
Get the child processes pids of a process (retrieve the complete process tree)
// This is a script to retrieve the child processes pids of a process (retrieve the complete process tree)
// Tn this example the process identified by pid 7400 is used
// (please to run the test chose a process pid that has at least 1 child process)
// (tested on windows)
package main
import (
"fmt"
"syscall"
@Shoozza
Shoozza / install_luarocks_windows_10.md
Last active March 10, 2024 09:34
Installing Luarocks on Windows with MSYS2 and gcc

Installing Luarocks on Windows

Getting Luarocks to work on Windows 8.1/10 with MSYS2 gcc (mingw64)

1. MSYS2 installation

  1. Visit https://www.msys2.org/
  2. Click on the link next to "Download the installer"
  3. Run the installer
  4. Add "C:\msys64\usr\bin" to path
@ukutaht
ukutaht / migration.sql
Created November 18, 2021 09:34
[Plausible Analytics] Clickhouse primary key migration
-- new events table
CREATE TABLE events_v2
(
`timestamp` DateTime Codec(DoubleDelta, LZ4),
`name` String,
`domain` String,
`user_id` UInt64,
`session_id` UInt64,
`hostname` String,
`pathname` String,