Skip to content

Instantly share code, notes, and snippets.

@helios2k6
helios2k6 / self-signed-certificate-with-custom-ca.md
Last active March 26, 2024 13:31 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl ecparam -genkey -name prime256v1 -noout -out <ROOT_CA_KEY>
@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

PyTorch C++ API Ubuntu Installation Guide

The best way to get a clean installation of PyTorch, is to install the pre-compiled binaries from the Anaconda distribution. Therefore, we need to setup Anaconda first.

Step 1: Install Anaconda

  • Go to the download section and download your desired Anaconda version for Linux

  • Run the downloaded shell script and follow the install instruction, do
@mustafo
mustafo / ContactPhonesTest.kt
Created August 31, 2018 04:31
The right way to use one to many relationship in jdbi with kotlin
import org.jdbi.v3.core.kotlin.KotlinMapper
import org.jdbi.v3.core.mapper.RowMapperFactory
import org.junit.jupiter.api.Test
import tj.alif.core.app.db.RepositoryTest
import org.jdbi.v3.core.result.RowView
data class Contact (
val id: Int,
val name: String,
@ToxicBakery
ToxicBakery / CircularArray.kt
Last active February 27, 2024 00:46
Simple circular/ring buffer style implementation backed by an array for kotlin with test coverage
import java.util.concurrent.atomic.AtomicInteger
class CircularArray<T> : Iterable<T>, Cloneable {
/**
* Creates a new instance of the array with the given size.
*/
constructor(bufferSize: Int) {
this.arr = arrayOfNulls(bufferSize)
this.tail = -1
@miguelmota
miguelmota / surround_quotes.sql
Created April 21, 2018 01:03
PostgreSQL surround output with double quotes
SELECT CONCAT('"', email, '"') FROM email_list;
# output all the colour combinations for text/background
# https://stackoverflow.com/questions/20541456/list-of-all-colors-available-for-powershell/41954792#41954792
$colors = [enum]::GetValues([System.ConsoleColor])
Foreach ($bgcolor in $colors){
Foreach ($fgcolor in $colors) { Write-Host "$fgcolor|" -ForegroundColor $fgcolor -BackgroundColor $bgcolor -NoNewLine }
Write-Host " on $bgcolor"
}

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active April 19, 2024 12:30
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@shivaas
shivaas / US Bank holidays (up to 2020)
Last active February 27, 2023 04:16
CSV for all US bank holidays till 2020. First row is the header. Dates are MYSQL format.
1,2012-01-02,New Year Day
2,2012-01-16,Martin Luther King Jr. Day
3,2012-02-20,Presidents Day (Washingtons Birthday)
4,2012-05-28,Memorial Day
5,2012-07-04,Independence Day
6,2012-09-03,Labor Day
7,2012-10-08,Columbus Day
8,2012-11-12,Veterans Day
9,2012-11-22,Thanksgiving Day
10,2012-12-25,Christmas Day