Skip to content

Instantly share code, notes, and snippets.

@PatrickChoDev
PatrickChoDev / devcontainer.json
Created November 10, 2023 18:26
PNPM devcontainer multiple project setup
{
"name": "Multiple PNPM projects",
// recommend using microsoft default image
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye",
// !!!! MAGIC STARTS HERE!!!
"mounts": [
"source=global-pnpm-store,target=${containerWorkspaceFolder}/.pnpm-store,type=volume"
@nitred
nitred / optimal_mtu.md
Last active May 4, 2024 09:21
Wireguard Optimal MTU

About

  • I faced bandwidth issues between a WG Peer and a WG server. Download bandwidth when downloading from WG Server to WG peer was reduced significantly and upload bandwidth was practically non existent.
  • I found a few reddit posts that said that we need to choose the right MTU. So I wrote a script to find an optimal MTU.
  • Ideally I would have liked to have run all possible MTU configurations for both WG Server and WG Peer but for simplicity I choose to fix the WG Server to the original 1420 MTU and tried all MTUs from 1280 to 1500 for the WG Peer.

Testing

  • On WG server, I started an iperf3 server
  • On WG peer, I wrote a script that does the following:
    • wg-quick down wg0
  • Edit MTU in the /etc/wireguard/wg0.conf file
@bergmannjg
bergmannjg / rearct-native-app-in-wsl2.md
Last active May 3, 2024 12:19
Building a react native app in WSL2
@douglasmakey
douglasmakey / sender.go
Last active February 2, 2024 17:05
Golang - send an email with attachments.
package main
import (
"bytes"
"encoding/base64"
"fmt"
"io/ioutil"
"mime/multipart"
"net/smtp"
"os"
@Mattemagikern
Mattemagikern / Certificates.go
Created May 9, 2019 08:31
Create x509 certificate chain using Golang. Root CA, Designated CA, server CA
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"fmt"
"math/big"
@behroozam
behroozam / Dockerfile
Last active March 4, 2024 12:15
send nginx custom log to elasticsearch with fluentd syslog input
FROM fluent/fluentd:v1.3-1
# Use root account to use apk
USER root
# below RUN includes plugin as examples elasticsearch is not required
# you may customize including plugins as you wish
RUN apk add --no-cache --update --virtual .build-deps \
build-base ruby-dev \
&& gem install \
@cecilemuller
cecilemuller / 2019-https-localhost.md
Last active May 2, 2024 16:43
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@mutin-sa
mutin-sa / Top_Public_Time_Servers.md
Last active May 4, 2024 00:53
List of Top Public Time Servers

Google Public NTP [AS15169]:

time.google.com

time1.google.com

time2.google.com

time3.google.com

@miguelmota
miguelmota / rsa_util.go
Last active April 21, 2024 15:10
Golang RSA encrypt and decrypt example
package ciphers
import (
"crypto/rand"
"crypto/rsa"
"crypto/sha512"
"crypto/x509"
"encoding/pem"
"log"
)
@chiliec
chiliec / example.go
Created November 30, 2017 08:53
Склонение числительных в golang
func declOfNum(number int, titles []string) string {
cases := []int{2, 0, 1, 1, 1, 2}
var currentCase int
if number % 100 > 4 && number % 100 < 20 {
currentCase = 2
} else if number % 10 < 5 {
currentCase = cases[number%10]
} else {
currentCase = cases[5]
}