Skip to content

Instantly share code, notes, and snippets.

View jacky9813's full-sized avatar

JackyCCChen jacky9813

  • Nextlink Technology
View GitHub Profile
@jacky9813
jacky9813 / read_auth.ps1
Last active May 15, 2026 06:38
Reading EFI_VARIABLE_AUTHENTICATION_2 for updating Secure Boot variables
<#
PowerShell - Read EFI_VARIABLE_AUTHENTICATION_2 binary
EFI_VARIABLE_AUTHENTICATION_2 are typically used for updating
Secure Boot variables like db, dbx and KEK. Examples can be
found in GitHub microsoft/secureboot_objects/PostSignedObjects
Download this script and import it:
Invoke-WebRequest -Uri "SCRIPT_URI" -OutFile "read_auth.ps1"
Import-Module .\read_auth.ps1
@jacky9813
jacky9813 / conf-diff-deb.sh
Created April 29, 2026 09:54
Show modified config file diffs
#!/bin/bash
# Show diff for modified config files - Debian/Ubuntu
TMP_DIR=/tmp/confcmp-$(date +%s)
declare -A package_mapping=()
download_package() {
package_name=$1
mkdir -p $TMP_DIR >/dev/null
package_uris=$(apt-get download --print-uris $package_name)
@jacky9813
jacky9813 / ubuntu-2604-gcp-image.sh
Created April 22, 2026 10:27
Just a testing script for libguestfs tools
#!/bin/bash
# This is just an experimental script for testing some of the virt-* tools.
# For production workloads, use the image supported by Google Cloud instead.
IMAGE_NAME="Ubuntu 26.04 LTS Resolute Raccoon"
SCRIPT_DIR=$(realpath $(dirname $BASH_SOURCE))
SOURCE_IMAGE_FILE="$(dirname "$SCRIPT_DIR")/src/ubuntu-server-26.04.qcow2"
SOURCE_IMAGE_DIR=$(dirname "$SOURCE_IMAGE_FILE")
SOURCE_IMAGE_URL=https://cloud-images.ubuntu.com/resolute/current/resolute-server-cloudimg-amd64.img
@jacky9813
jacky9813 / rehydrate_all.py
Last active May 12, 2025 06:38
Azure Storage Account - Rehydrate all archived blobs
#!/usr/bin/env python3
# Requires Python 3.12 or later
import itertools
import typing as t
import azure.core.credentials
import azure.core.pipeline.transport
import azure.identity
import azure.mgmt.storage
import azure.mgmt.storage.models
@jacky9813
jacky9813 / AWS-RunPatchBaseline.stderr.txt
Last active March 18, 2025 09:22
Terraform Provider AWS - aws_ssm_patch_baseline issue
Retrieving snapshot failed.failed to run commands: exit status 143
@jacky9813
jacky9813 / install-nv-driver-fc41.md
Created October 31, 2024 01:47
Install NVIDIA proprietary driver on Fedora 41

There are some steps that is not documented in the RPMFusion's installation guide. Here's how I install NVIDIA driver on Fedora 41.

  1. Update all packages and reboot
  2. Install akmod-nvidia from RPMFusion, optionally with packages for CUDA or NVENC.
  3. For some reason, after akmod installation, I didn't see modeset=1 on kernel option, so:
#!/bin/bash
@jacky9813
jacky9813 / [email protected]
Last active February 9, 2025 07:25
Minecraft Server
[Unit]
Description=Minecraft Server in /opt/minecraft-server/%i
After=network-online.target
Requires=network-online.target
[Service]
Type=simple
KillSignal=SIGINT
ExecStart=/opt/minecraft-server/%i/run.sh --nogui
WorkingDirectory=/opt/minecraft-server/%i
@jacky9813
jacky9813 / convert-to-efi.chroot.sh
Created April 20, 2024 09:49
[Linux] Convert boot mode to UEFI
#!/bin/bash
#
# Convert to EFI
#
# IMPORTANT NOTES:
# * This script CAN ONLY BE running in a chrooted environment.
# * This script will install shim, but still secure boot may fail.
#
# Tested for CentOS 7, but should have a similar process for all other
# Linux distros, at least for RHEL for its derivatives.
@jacky9813
jacky9813 / azurerm_error.log
Created March 6, 2024 10:33
Terraform error log from AzureRM
2024-03-06T18:30:30.003+0800 [ERROR] provider.terraform-provider-azurerm_v3.93.0_x5: Response contains error diagnostic:
diagnostic_summary=
| deleting Load Balancer Backend Address Pool (Subscription: "<REDACTED>"
| Resource Group Name: "<REDACTED>"
| Load Balancer Name: "example-lb"
| Backend Address Pool Name: "example-lb-be-address-pool"): performing LoadBalancerBackendAddressPoolsDelete: unexpected status 400 with error: LoadBalancerBackendAddressPoolInUseByVirtualMachineScaleSet: Cannot remove backend address pool example-lb-be-address-pool from load balancer since it is in use by virtual machine scale set /subscriptions/<REDACTED>/resourceGroups/<REDACTED>/providers/Microsoft.Compute/virtualMachineScaleSets/example-vmss.
tf_provider_addr=provider tf_resource_type=azurerm_lb_backend_address_pool @module=sdk.proto diagnostic_detail="" tf_req_id=afb22b8f-5f14-9af2-02f4-e818d11f69c4 diagnostic_severity=ERROR @caller=github.com/hashicorp/[email protected]/tfprotov5/internal/diag/diagn