Skip to content

Instantly share code, notes, and snippets.

@nathanlogan
nathanlogan / component.js
Created November 15, 2016 19:29
Emulate URL anchor page scroll functionality in a React component
import React, { Component } from 'react'
class MyTopLevelComponent extends Component {
componentDidMount () {
this.scrollToHashId()
}
componentDidUpdate () {
this.scrollToHashId()
}
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active April 13, 2026 05:08
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Last update: Nov 2025.

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 secp384r1 | openssl ec -aes256 -out rootCA.key
@klingerf
klingerf / openssl.cnf
Created May 13, 2016 01:47
Sample openssl config file
dir = certificates
[ ca ]
default_ca = CA_default
[ CA_default ]
serial = $dir/serial
database = $dir/index.txt
new_certs_dir = $dir/newcerts
certificate = $dir/cacert.pem
@olih
olih / jq-cheetsheet.md
Last active April 23, 2026 10:41
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@mondain
mondain / public-stun-list.txt
Last active April 21, 2026 01:31
Public STUN server list
23.21.150.121:3478
iphone-stun.strato-iphone.de:3478
numb.viagenie.ca:3478
s1.taraba.net:3478
s2.taraba.net:3478
stun.12connect.com:3478
stun.12voip.com:3478
stun.1und1.de:3478
stun.2talk.co.nz:3478
stun.2talk.com:3478
@dingledow
dingledow / android_emulator_paste_test
Last active July 29, 2025 08:49
Paste Text on Android Emulator
adb shell input text 'my string here. With some characters escaped like \$ that'
@mitio
mitio / memory_cache.js
Last active February 5, 2023 16:23
Simple in-memory JavaScript object cache with a maxAge per key (in seconds) and maxEntries limit (per cache instance).
var MemoryCache = function (options) {
options = $.extend(true, {
maxEntries: null
}, options || {});
var self = this;
var cache = {};
var entries = 0;
var ageOf = function (entry) {
%reset-Button {
border: none;
margin: 0;
padding: 0;
width: auto;
overflow: visible;
background: transparent;
/* inherit font & color from ancestor */
@afternoon
afternoon / rename_js_files.sh
Created February 15, 2014 18:04
Rename .js files to .ts
find app/src -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \;