Skip to content

Instantly share code, notes, and snippets.

View alpenfritz's full-sized avatar
😃

Yi-Tze Lin alpenfritz

😃
View GitHub Profile
@alpenfritz
alpenfritz / README.md
Created April 17, 2024 01:45 — forked from pcan/README.md
Node.js plain TLS Client & Server, 2-way Cert Auth

Node.js TLS plain TLS sockets

This guide shows how to set up a bidirectional client/server authentication for plain TLS sockets.

Newer versions of openssl are stricter about certificate purposes. Use extensions accordingly.

Prepare certificates

Generate a Certificate Authority:

@alpenfritz
alpenfritz / bash_strict_mode.md
Created November 25, 2022 04:33 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation
https://unix.stackexchange.com/questions/125382/migrate-socat-init-script-to-systemd
For socat, I use a pure systemd approach. This is an example for a serial loopback:
[Unit]
Description=Socat Serial Loopback
#Before=my-other.service
[Service]
Type=simple
@alpenfritz
alpenfritz / different-ssh-deploy-keys-multiple-private-repos-github-go-mod.md How to use different ssh deploy keys for multiple private github repositories with Golang Modules (go mod)

How to use different ssh deploy keys for multiple private github repositories with Go Modules

Let's assume you are using Go Modules and have a go.mod file that contains multiple private repos each with a different ssh key. How can you get go mod download to do the right thing -- i.e. use ssh key A with private repo A and ssh key B with private repo B?

Ok, here we go!

Let's assume you have some github.com user with multiple private repos:

https://github.com/someuser/private-repo-1

@alpenfritz
alpenfritz / README.md
Created November 5, 2020 07:15 — forked from rantav/README.md
Find slow queries in mongo DB

A few show tricks to find slow queries in mongodb

Enable profiling

First, you have to enable profiling

> db.setProfilingLevel(1)

Now let it run for a while. It collects the slow queries ( > 100ms) into a capped collections, so queries go in and if it's full, old queries go out, so don't be surprised that it's a moving target...

@alpenfritz
alpenfritz / nginx.conf
Created November 2, 2020 05:48 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@alpenfritz
alpenfritz / iterm2-solarized.md
Created May 28, 2019 03:25 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

@alpenfritz
alpenfritz / understandOnce.js
Last active December 12, 2017 07:54
JS BinUnderstand _.once function// source https://jsbin.com/mumoxip
// var chores = function () {
// var tasks = ['laundry', 'dishes', 'vaccuum', 'dust'];
// return {
// doChores: function () {
// console.log(tasks.pop());
// },
// addChores: function (task) {
// tasks.push(task);
// return task;