Skip to content

Instantly share code, notes, and snippets.

@lipe-dev
lipe-dev / canada-driver-license-numbers.js
Last active March 9, 2023 11:19
Regexes for all US states and Canada provinces driver licenses. Each one has their own rules.
// Some info based on: https://learn.microsoft.com/en-us/microsoft-365/compliance/sit-defn-canada-drivers-license-number?view=o365-worldwide
const canadaDLNumberPatterns = {
Alberta: /\d{6}-\d{3}|\d{5,9}/,
"British Columbia": /\d{7}/,
Manitoba: /\w{2}-?\w{2}-?\w{2}-?\w\d{3}\w{2}/,
"New Brunswick": /\d{5,7}/,
"Newfoundland and Labrador": /\w\d{9}/,
"Nova Scotia": /\w{5}-?[0123]\d[01]\d{6}/,
Ontario: /\w\d{4}-?\d{5}\d[0156]\d[0123]\d/,
@Kranzes
Kranzes / guide.md
Last active April 15, 2024 22:33
SSH Resident Key Guide

Initial checks

Start by checking that there aren't any previous ssh keys inside the FIDO2 authenticator of your YubiKey. You can check if they exist by running the command below:

nix shell nixpkgs#yubikey-manager -c ykman fido credentials list

If the command above outputs a string mentioning "ssh" or "openssh", then you have already got a key generated and store on your YubiKey.

Evaluating additional authentication factors

Before generating a new ssh key to store on your YubiKey you must consider which additional required authentication factors you want to use. Below you can see a table with the available factors and their corresponding command:

Setup tor proxy on Arch Linux

Copied from this article.

Installation

  1. Install tor

         $ sudo pacman -S tor
         $ ## nyx provides a terminal status monitor for bandwidth usage, connection details and more.

$ sudo pacman -S nyx

@artizirk
artizirk / gnupg_scdaemon.md
Last active April 3, 2024 14:49
OpenPGP SSH access with Yubikey and GnuPG

NB: This document describles a 'Old-School' way of using Yubikey with SSH

Modern OpenSSH has native support for FIDO Authentication. Its much simpler and should also be more stable with less moving parts. OpenSSH also now has support for signing arbitary files witch can be used as replacement of gnupg. Git also supports signing commits/tags with ssh keys.

Pros of FIDO

  • Simpler stack / less moving parts
  • Works directly with ssh, ssh-add and ssh-keygen on most computers
  • Simpler
  • Private key can never leave the FIDO device

Cons of FIDO

@mohanpedala
mohanpedala / bash_strict_mode.md
Last active April 19, 2024 06:11
set -e, -u, -o, -x pipefail explanation
@dragonken
dragonken / .vimrc
Last active April 11, 2024 13:27
YAML space indent for vim
syntax on
filetype plugin indent on
"Get the 2-space YAML as the default when hit carriage return after the colon
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
set is hlsearch ai ic scs
nnoremap <esc><esc> :nohls<cr>
"https://vim.fandom.com/wiki/Moving_lines_up_or_down
@dusenberrymw
dusenberrymw / spark_tips_and_tricks.md
Last active February 8, 2023 05:11
Tips and tricks for Apache Spark.

Spark Tips & Tricks

Misc. Tips & Tricks

  • If values are integers in [0, 255], Parquet will automatically compress to use 1 byte unsigned integers, thus decreasing the size of saved DataFrame by a factor of 8.
  • Partition DataFrames to have evenly-distributed, ~128MB partition sizes (empirical finding). Always err on the higher side w.r.t. number of partitions.
  • Pay particular attention to the number of partitions when using flatMap, especially if the following operation will result in high memory usage. The flatMap op usually results in a DataFrame with a [much] larger number of rows, yet the number of partitions will remain the same. Thus, if a subsequent op causes a large expansion of memory usage (i.e. converting a DataFrame of indices to a DataFrame of large Vectors), the memory usage per partition may become too high. In this case, it is beneficial to repartition the output of flatMap to a number of partitions that will safely allow for appropriate partition memory sizes, based upon the
@dvbobrov
dvbobrov / spark-env.sh
Created July 4, 2016 20:44
Making spark-submit work with s3a:// URLs
SPARK_DIST_CLASSPATH="/opt/spark/lib/aws-java-sdk-1.7.4.jar:/opt/spark/lib/hadoop-aws-2.6.0.jar"
@ygotthilf
ygotthilf / jwtRS256.sh
Last active April 17, 2024 04:10
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@tuxfight3r
tuxfight3r / tcp_flags.txt
Last active April 17, 2024 14:48
tcpdump - reading tcp flags
##TCP FLAGS##
Unskilled Attackers Pester Real Security Folks
==============================================
TCPDUMP FLAGS
Unskilled = URG = (Not Displayed in Flag Field, Displayed elsewhere)
Attackers = ACK = (Not Displayed in Flag Field, Displayed elsewhere)
Pester = PSH = [P] (Push Data)
Real = RST = [R] (Reset Connection)
Security = SYN = [S] (Start Connection)