Skip to content

Instantly share code, notes, and snippets.

View ctrlaltdev's full-sized avatar
😼
All your cats are belong to us

yorick ctrlaltdev

😼
All your cats are belong to us
View GitHub Profile
@ctrlaltdev
ctrlaltdev / genJWK.js
Last active November 1, 2023 21:39
Generate JWK key pair
import crypto from 'crypto'
import { writeFileSync } from 'fs'
async function exportCryptoKeyToPEM(key) {
const exported = await crypto.subtle.exportKey('pkcs8', key)
const pemExported = `-----BEGIN PRIVATE KEY-----\n${Buffer.from(exported).toString('base64')}\n-----END PRIVATE KEY-----`
return pemExported
}
#!/bin/sh
version=v1.0.0-alpha-1
os=$1
arch=$2
if [ -z "$os" ] || [ -z "$arch" ]; then
echo -n "What is your OS? [darwin/linux] "
read os < /dev/tty
@ctrlaltdev
ctrlaltdev / dnscomp
Created January 20, 2022 00:29
Basic Bash Script to compare DNS records between the default NS and a provided one - used to make sure I copied all the records with the correct values before changing the NS servers
#!/usr/bin/env bash
DOMAIN=$1
NS=$2
TYPE=$3
ORIG_SOA=$(dig SOA $1 | awk '{print $5}')
COMP_SOA=$(dig SOA $1 @$2 | awk '{print $5}')
echo -en "$ORIG_SOA\t"
#!/bin/sh
version=v2.1.0
os=$1
arch=$2
if [ -z "$os" ] || [ -z "$arch" ]; then
echo -n "What is your OS? [darwin/linux] "
read os < /dev/tty
@ctrlaltdev
ctrlaltdev / .zshrc
Last active January 31, 2021 01:19
.zshrc
# ██╗ ██╗ ██████╗ ██╗██████╗
# ██║ ██║██╔═══██╗██║██╔══██╗
# ██║ ██║██║ ██║██║██║ ██║
# ╚██╗ ██╔╝██║ ██║██║██║ ██║
# ╚████╔╝ ╚██████╔╝██║██████╔╝
# ╚═══╝ ╚═════╝ ╚═╝╚═════╝
echo " _ _ "
echo " _ _ ___ |_| _| |"
echo " | | || . || || . |"
import time
import math
def loader(index=0, total=100):
max = 25
tty = math.floor(index * max / total)
bar = ('#' * tty) + ('_' * (max - tty))
print('[{}] - {}/{}'.format(bar, index, total), end = '\n' if index == total else '\r')
@ctrlaltdev
ctrlaltdev / statelist.html
Last active October 31, 2018 18:46 — forked from d33pfri3d/statelist.html
Datalist of US States
<datalist id="statelist">
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
<option value="FL">Florida</option>
@ctrlaltdev
ctrlaltdev / badges.md
Last active October 28, 2023 12:38
Tech Badges
LANGUAGE BADGE MD
ASSEMBLY ASSEMBLY ![ASSEMBLY](https://img.shields.io/badge/_-ASM-6E4C13.svg?style=for-the-badge)
C C ![C](https://img.shields.io/badge/_-C-555555.svg?style=for-the-badge)
C# C# ![C#](https://img.shields.io/badge/_-CS-178600.svg?style=for-the-badge)
C++ C++ ![C++](https://img.shields.io/badge/_-CPP-F34B7D.svg?style=for-the-badge)
CSS CSS ![CSS](https://img.shields.io/badge/_-CSS-563D7C.svg?style=for-the-badge)
DART DART ![DART](https://img.shields.io/badge/_-DART-00B4AB.svg?style=for-the-badge)
DOCKERFILE ![DOCKERFILE](https:
@ctrlaltdev
ctrlaltdev / color-scale.js
Last active May 25, 2023 06:38 — forked from mlocati/color-scale.js
Javascript color scale from 0% to 100%, rendering it from red to yellow to green to blue to magenta
function colorScale(int) {
let r, g, b = 0
if (int >= 0 && int <= 20) {
r = 255
g = Math.round(12.75 * int)
b = 0
} else if (int > 20 && int <= 40) {
r = Math.round(-12.75 * int + 510)
g = 255
@ctrlaltdev
ctrlaltdev / web_error_handling.js
Last active September 14, 2020 18:57
js error handling based on the internets
try {
// do something
} catch (e) {
console.warn(e.message)
const xcb = `https://stackoverflow.com/search?q=[js]+${e.message}`
window.open(xcb, '_blank')
}