Skip to content

Instantly share code, notes, and snippets.

View bsodmike's full-sized avatar

Michael de Silva bsodmike

View GitHub Profile
@o0-o
o0-o / gpg_add_key.sh
Last active October 28, 2021 07:00
Unattended/Automated GPG Key Scripts for Yubikey
#!/usr/bin/env sh
# Run this on an air-gapped computer with an encrypted hard drive to set up GPG keys on your yubikey.
# Derived from https://github.com/drduh/YubiKey-Guide
# Assumes OS has already been prepared (packages, services, etc) -- see dr duh guide.
# Does not configure PINs on the yubikey. If no admin pin is provided, the default 12345678 is used.
#
# Usage: gpg_add_yubi.sh gpg-backup.tar.gz gpg_passhrase [yubikey_admin_pin]
########################################################################
# Safety and portability
@sekcompsci
sekcompsci / Comparison Espressif ESP MCUs.md
Created June 18, 2021 03:56 — forked from fabianoriccardi/Comparison Espressif ESP MCUs.md
Comparison table for ESP8266/ESP32/ESP32-S2/ESP32-S3/ESP32-C3/ESP32-C6

Comparison table for ESP8266/ESP32/ESP32-S2/ESP32-S3/ESP32-C3/ESP32-C6

A minimal table to compare the Espressif's MCU families.

ESP8266 ESP32 ESP32-S2 ESP32-S3 ESP32-C3 ESP32-C6
Announcement Date 2014, August 2016, September 2019, September 2020, December
@thugcee
thugcee / tmux-switch-pane.sh
Created January 11, 2021 22:56
tmux and fzf: fuzzy tmux session/window/pane switcher (this version uses tmux new popup window)
#!/bin/bash
# customizable
LIST_DATA="#{window_name} #{pane_title} #{pane_current_path} #{pane_current_command}"
FZF_COMMAND="fzf-tmux -p --delimiter=: --with-nth 4 --color=hl:2"
# do not change
TARGET_SPEC="#{session_name}:#{window_id}:#{pane_id}:"
# select pane
@jjenkins70
jjenkins70 / README.md
Created January 23, 2020 19:29
HashiCorp Vault TLS Certificate Auth Samples

Simple Vault TLS Certificate validation & testing

Set of scripts to deploy locally, vault and configure TLS server and user certificates for testing TLS AUTH.

credit to @reard3n (https://github.com/reard3n) and @v6 (https://github.com/v6) for the gist this grew from

Notes

This was tested using Vagrant and Ubuntu

Getting Setup

  • On the OS of your choice copy VaultCASetup.sh script locally and update any variables that would be specific to your environment and/or
@jimmychu0807
jimmychu0807 / string-conversion.rs
Created November 21, 2019 10:20
Conversion between String, str, Vec<u8>, Vec<char> in Rust
use std::str;
fn main() {
// -- FROM: vec of chars --
let src1: Vec<char> = vec!['j','{','"','i','m','m','y','"','}'];
// to String
let string1: String = src1.iter().collect::<String>();
// to str
let str1: &str = &src1.iter().collect::<String>();
// to vec of byte
#!/bin/bash
for d in /sys/kernel/iommu_groups/*/devices/*; do
n=${d#*/iommu_groups/*}; n=${n%%/*}
printf 'IOMMU Group %s ' "$n"
lspci -nns "${d##*/}"
done
@ishan-marikar
ishan-marikar / ssh-ssl.js
Last active March 1, 2017 15:02
An SSH/HTTPS proxy that listens on port 443 and proxies traffic depending on what kind of data it is.
const net = require('net');
const LISTENING_PORT = 443;
const HTTPS_PORT = 4443;
const SSH_PORT = 22;
var proxySwitch = function(connection) {
connection.once('data', function(buffer) {
// A TLS handshake record starts with byte 22.
if (buffer[0] === 22) {
@KodrAus
KodrAus / Profile Rust on Linux.md
Last active November 14, 2023 17:19
Profiling Rust Applications

Profiling performance

Using perf:

$ perf record -g binary
$ perf script | stackcollapse-perf.pl | rust-unmangle | flamegraph.pl > flame.svg

NOTE: See @GabrielMajeri's comments below about the -g option.

@dexterous
dexterous / psql_check.sh
Last active August 15, 2017 18:12
Quick n' dirty script to monitor PostgreSQL connectivity and connect latency and post metrics to AWS Cloudwatch
#!/bin/bash
export PGPASSWORD='password'
IFS=':'
echo ''
date '+%F %T'
for HOST in www.{foo,bar}.com; do
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Setting up your own private and secure VPN",
"Mappings": {
"AWSInstanceType2Arch": {
"High.Speed.VPN-Paid": {
"InstanceType": "t2.medium"
},
"Standard.VPN-Free": {
"InstanceType": "t2.micro"