Skip to content

Instantly share code, notes, and snippets.

View Chaz6's full-sized avatar

Chris Hills Chaz6

View GitHub Profile
@Chaz6
Chaz6 / build-llvm-on-almalinux.bash
Last active April 14, 2024 15:24
build-llvm-on-almalinux.bash
#!/usr/bin/bash
LLVM_VERSION=18.1.3
LLVM_VERSION_BETA=
PREFIX=$HOME
if [ -n "$LLVM_VERSION_BETA" ]; then
FILENAME="llvm-project-${LLVM_VERSION}${LLVM_VERSION_BETA}.src.tar.xz"
INSTALL_PREFIX="$PREFIX/.local/local/llvm-${LLVM_VERSION}${LLVM_VERSION_BETA}"
@Chaz6
Chaz6 / build-python-on-almalinux.bash
Created April 14, 2024 15:20
build-python-on-almalinux.bash
#!/usr/bin/bash
PYTHON_VERSION=3.13.0
BETA_VERSION=a6
INSTALLDIR="${HOME}"/.local/local
cd /tmp &&
wget -4 "https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}${BETA_VERSION}.tar.xz" &&
echo "Extracting archive..." &&
tar xvf "Python-${PYTHON_VERSION}${BETA_VERSION}.tar.xz" &&
@Chaz6
Chaz6 / jnh_exception_packet_trace.rb
Created May 19, 2022 12:05 — forked from ytti/jnh_exception_packet_trace.rb
script to turn JunOS Trio exception capture into a PCAP
#!/usr/bin/env ruby
# script to generate PCAP from Trio exception trace. Potentially you may need to change POP_BYTES variable.
# Trio exception trace allows you to capture things like broken packets (checksum error), to see who is sending them
# clogin junos-trio-box | tee exception_trace
# start shell pfe network fpc0
# show jnh 0 exceptions terse
# debug jnh exceptions N discard ## get N from above command
# debug jnh exceptions-trace
@Chaz6
Chaz6 / domains.txt
Last active December 18, 2021 14:35
Generate a hosts file using DNS64
www.example.com 93.184.216.34
@Chaz6
Chaz6 / readme.md
Last active February 14, 2024 15:19
How to replace UEFI Secure Boot certificates in VMware

Custom Secure Boot configuration while deploying a new Virtual Machine

The Secure Boot configuration is stored in NVRAM. If the NVRAM contains no Secure Boot configuration (a freshly deployed VM, or a VM for which the .nvram file has been deleted from the datastore), the Secure Boot configuration will be reset to the defaults described in the UEFI Specification (the variables named PKDefault, KEKDefault, dbDefault and dbxDefault). You can use advanced VM config options to control those defaults, through which you can pre-populate the Secure Boot configuration before the VM is first powered on.

If you want to deploy the certificates as part of the VM's configuration, copy the DER-encoded certificate into the VM's directory and add the following advanced VM config options:

uefi.secureBoot.dbDefault.file0 = "custom-cert.der"

where "custom-cert.der" is the name of the DER-encoded certificate file within the VM's directory. You can repeat that for file1, file2, file3, etc., to add multiple certificate

@Chaz6
Chaz6 / python39-patch-sqlite-trace-v2.patch
Created October 13, 2020 15:45
Patch to support current SQLlite with Python 3.9
--- Python-3.9.0/Modules/_sqlite/connection.c.old 2020-10-05 16:07:58.000000000 +0100
+++ Python-3.9.0/Modules/_sqlite/connection.c 2020-10-13 16:40:28.161985539 +0100
@@ -1063,10 +1063,10 @@
if (trace_callback == Py_None) {
/* None clears the trace callback previously set */
- sqlite3_trace(self->db, 0, (void*)0);
+ sqlite3_trace_v2(self->db, SQLITE_TRACE_STMT, 0, (void*)0);
Py_XSETREF(self->function_pinboard_trace_callback, NULL);
} else {
@Chaz6
Chaz6 / fetch-ipset-from-asn.bash
Last active May 13, 2022 07:46
Generate an ipset for a given autonomous system number
#!/bin/bash
usage()
{
echo "Usage: $0 [ASN]"
}
if [ $# -ne 1 ]; then
usage
exit 1
@Chaz6
Chaz6 / thumbnail-videos-as-webpage.bash
Last active January 25, 2019 19:57
Generate a thumbnail web page for a folder of videos
#!/bin/bash
SIZE=400
cat >index.html<<EOF
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Thumbnail gallery</title>
@Chaz6
Chaz6 / tumblr-get.py
Created December 3, 2018 18:56
Threaded tumblr image/video downloader
#!/usr/bin/env python
import os, sys, re, time
from shutil import copyfileobj
from urllib.request import urlopen, unquote
from xml.etree import ElementTree as ET
from socket import error as socket_error
import socket
import requests
@Chaz6
Chaz6 / sort-folders-by-largest-file.py
Last active February 5, 2019 18:59
sort-folders-by-largest-file.py
#!/bin/python3.6
import pathlib
import shutil
import os
def filesize(path):
return path.stat().st_size
def biggest(folder):