Skip to content

Instantly share code, notes, and snippets.

View ibejohn818's full-sized avatar

John Hardy ibejohn818

  • GoDaddy Inc
  • Los Angeles, Ca
View GitHub Profile
@ibejohn818
ibejohn818 / openssl.sh
Last active February 10, 2024 21:24
openssl one liners
#!/usr/bin/env bash
# ca
openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 \
-nodes -keyout ca.key -out ca.pem -subj "/C=US/ST=CA/O=Lab/OU=Engineering/CN=ca.johnhardy.io" \
-addext "subjectAltName=DNS:ca.johnhardy.io,IP:10.0.0.1"
# server csr
openssl req -new -newkey rsa:4096 -nodes \
@ibejohn818
ibejohn818 / pass.sh
Created September 18, 2022 18:52
standard unix password manager - wsl2 clipboard mod
#!/usr/bin/env bash
# Copyright (C) 2012 - 2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
# This file is licensed under the GPLv2+. Please see COPYING for more information.
umask "${PASSWORD_STORE_UMASK:-077}"
set -o pipefail
GPG_OPTS=( $PASSWORD_STORE_GPG_OPTS "--quiet" "--yes" "--compress-algo=none" "--no-encrypt-to" )
GPG="gpg"
@ibejohn818
ibejohn818 / certs.go
Last active August 11, 2022 20:47
Load pem cert/key file into tls.Certificate
import (
"crypto"
"crypto/ecdsa"
"crypto/rsa"
"crypto/tls"
"crypto/x509"
"encoding/pem"
"fmt"
"io/ioutil"
@ibejohn818
ibejohn818 / jwt.js
Created December 30, 2020 01:54
parse jwt
function parseJwt (token) {
var base64Url = token.split('.')[1];
var base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
var jsonPayload = decodeURIComponent(atob(base64).split('').map(function(c) {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
}).join(''));
return JSON.parse(jsonPayload);
};
@ibejohn818
ibejohn818 / bench-dd.sh
Last active November 4, 2020 01:03
Bench.sh with network removed and disk modded
#!/usr/bin/env bash
#
# Description: Auto test download & I/O speed script
#
# Copyright (C) 2015 - 2020 Teddysun <i@teddysun.com>
# Thanks: LookBack <admin@dwhd.org>
# URL: https://teddysun.com/444.html
#
trap _exit INT QUIT TERM
echo -n "Open VPN Volume name: "
read volname
echo -n "Client/User name: "
read client
export OVPN_DATA="${volname}"
docker volume create --name $OVPN_DATA
@ibejohn818
ibejohn818 / tblick
Last active August 20, 2020 17:53
Tunnelblick connect via CLI
#!/usr/bin/env bash
read -r -d '' USAGE <<'USAGEEND'
tblick - Launch tunnelblick and connect to VPN
Examples:
Launch tunnelblick and connect to VPN
$ tblick [TUNNELBLICK-VPN-NAME]
Options:
export PATH="/usr/local/opt/llvm/bin:$PATH"
export CC="/opt/local/bin/clang-mp-10"
export CXX="/opt/local/bin/clang++-mp-10"
export CXX11="/opt/local/bin/clang++-mp-10"
export CXX14="/opt/local/bin/clang++-mp-10"
export CXX17="/opt/local/bin/clang++-mp-10"
export CXX1X="/opt/local/bin/clang++-mp-10"
export LDFLAGS="-L/usr/local/opt/llvm/lib"
export CPPFLAGS="-I/usr/local/opt/llvm/include"
docker exec {CONTAINER} killall -USR2 openvpn
docker logs {OPENVPN_CONTAINER}
import express from 'express'
const app = express()
import AWS from 'aws-sdk'
const fs = require('fs')
const path = require('path')
const mtype = require('mime-types')
const BUCKET = "mt-jhardy"
const PORT = 8080