Skip to content

Instantly share code, notes, and snippets.

@calvin2021y
calvin2021y / h2c.go
Created July 3, 2025 10:28 — forked from tom-code/h2c.go
golang h2c http2 client and server
package main
import (
"fmt"
"net/http"
"golang.org/x/net/http2"
"golang.org/x/net/http2/h2c"
"crypto/tls"
"net"
)
@calvin2021y
calvin2021y / fossil-git-mirror.sh
Created June 8, 2025 10:53 — forked from mgoellnitz/fossil-git-mirror.sh
Shell script to mirror a Fossil SCM repository to github.com
#!/bin/sh
#
# Copyright 2016 Martin Goellnitz
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@calvin2021y
calvin2021y / How to TPM on Linux.md
Created March 15, 2025 06:59 — forked from kmille/How to use a TPM on Linux.md
How to use a TPM on Linux

How to use a TPM on Linux

Prerequisites

  • I use it on Arch Linux
  • Install dependency: yay tpm2-tools

Do I have a TPM 2.0?

kmille@linbox:~ journalctl --boot --dmesg --grep=tpm_tis
@calvin2021y
calvin2021y / .gitignore
Created August 8, 2024 07:32 — forked from jalcine/.gitignore
Getting libuv and zeromq working together (polling setup)
build
@calvin2021y
calvin2021y / podman_macos.md
Created July 24, 2024 15:58 — forked from kaaquist/podman_macos.md
Podman with docker-compose on MacOS.

Podman with docker-compose on MacOS.

Podman an alternative to Docker Desktop on MacOS

Getting podman installed and started is super easy.
Just use brew to install it.

> brew install podman

Now since podman uses a VM just like the Docker Client on MacOS we need to initialize that and start it.

@calvin2021y
calvin2021y / npm-using-https-for-git.sh
Created July 4, 2024 14:05 — forked from taoyuan/npm-using-https-for-git.sh
Force git to use https:// instead of git://
# npm using https for git
git config --global url."https://github.com/".insteadOf [email protected]:
git config --global url."https://".insteadOf git://
# npm using git for https
git config --global url."[email protected]:".insteadOf https://github.com/
git config --global url."git://".insteadOf https://
@calvin2021y
calvin2021y / nginx.conf
Created May 10, 2024 12:07 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
// 1) "Tables of linear congruential generators of different sizes and good lattice structure" (1999), Pierre L'Ecuyer
// 2) Pre-print version of (3) (https://arxiv.org/abs/2001.05304)
// 3) "Computationally easy, spectrally good multipliers for congruential pseudorandom number generators" (2021), Guy L. Steele Jr. & Sebastiano Vigna (https://onlinelibrary.wiley.com/doi/epdf/10.1002/spe.3030)
// inline comment number is bit width of constant
const uint32_t lcg_mul_k_table_32[] =
{
// (3) Table 4 LCGs
0x0000d9f5, // 16
@calvin2021y
calvin2021y / brew-dnsmasq.md
Created May 3, 2024 10:13 — forked from davebarnwell/brew-dnsmasq.md
install dnsmasq with brew

Install dnsmasq and configure for *.dev.local domains

$ brew install dnsmasq
$ vim /usr/local/etc/dnsmasq.conf

Reload configuration and clear cache

# Copy the daemon configuration file into place.
$ sudo cp $(brew list dnsmasq | grep /homebrew.mxcl.dnsmasq.plist$) /Library/LaunchDaemons/

$ sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist

@calvin2021y
calvin2021y / codesign_gdb.md
Created March 11, 2024 07:09 — forked from hlissner/codesign_gdb.md
Codesign gdb on OSX