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
sudo dkms status
# list nvidia installs
ls -l /var/lib/dkms/nvidia
# install for kernel version 535.154.05
dkms install nvidia/535.154.05 -k 6.7.3-060703-generic
#include <opencv2/opencv.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <sstream>
#include <string>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
# vim:ft=zsh ts=2 sw=2 sts=2
rvm_current() {
rvm current 2>/dev/null
}
rbenv_version() {
rbenv version 2>/dev/null | awk '{print $1}'
}
evil_git_untracked_files() {
@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 <[email protected]>. 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 <[email protected]>
# Thanks: LookBack <[email protected]>
# 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: