Skip to content

Instantly share code, notes, and snippets.

View schnell18's full-sized avatar

Justin Zhang schnell18

View GitHub Profile
@schnell18
schnell18 / diag_fix_ath12k_wifi7_driver.sh
Created August 31, 2025 01:03
Fix Ubuntu 24.04 Wifi7 driver issue
sudo dmesg | grep ath12k
# [ 6.100088] ath12k_pci 0000:06:00.0: BAR 0 [mem 0x81200000-0x813fffff 64bit]: assigned
# [ 6.100107] ath12k_pci 0000:06:00.0: enabling device (0000 -> 0002)
# [ 6.100266] ath12k_pci 0000:06:00.0: MSI vectors: 16
# [ 6.100270] ath12k_pci 0000:06:00.0: Hardware name: wcn7850 hw2.0
# [ 6.264622] mhi mhi0: Direct firmware load for ath12k/WCN7850/hw2.0/amss.bin failed with error -2
# [ 6.264640] ath12k_pci 0000:06:00.0: failed to set mhi state: POWER_ON(2)
# [ 6.264642] ath12k_pci 0000:06:00.0: failed to start mhi: -110
# [ 6.264643] ath12k_pci 0000:06:00.0: failed to power up :-110
@schnell18
schnell18 / shutdown_vboxnet0
Created November 15, 2013 13:47
Remove and re-create the host only network vboxnet0 to work around issue which hangs OSX Maverick shutdown process
#!/bin/sh
# This script is a workaround to virtualbox
# hostonly network hang on OSX Maverick.
vboxmanage hostonlyif remove vboxnet0
vboxmanage hostonlyif create
@schnell18
schnell18 / create_chrootjail.sh
Created November 3, 2013 05:23
Script to automate the creation of chroot jail w/ minimal executables to run git.
#!/bin/sh
# script to automate the creation of chroot jail
# w/ minimal executables to run git
export CHROOT=/var/chroot
function copy_binary() {
for i in $(ldd $*|grep -v dynamic|cut -d " " -f 3|sed 's/://'|sort|uniq)
do
cp --parents $i $CHROOT
@schnell18
schnell18 / force-rtc-to-sys.sh
Created May 11, 2026 21:54
Force system time to RTC
sudo hwclock --hctosys
@schnell18
schnell18 / pip_mirror.sh
Last active May 6, 2026 14:14
setup pip mirror in China
mkdir ~/.pip
cat <<EOF > ~/.pip/pip.conf
[global]
trusted-host = mirrors.aliyun.com
index-url = http://mirrors.aliyun.com/pypi/simple
EOF
@schnell18
schnell18 / combine-pdfs.sh
Created May 2, 2026 00:51
Combined pdf files in reverse order by file name
#!/bin/bash
# pdfunite is part of poppler package
# use `brew install poppler` to install
SOURCE_PDFS=$(ls *.PDF | sort -r | xargs)
pdfunite $SOURCE_PDFS combined.pdf
@schnell18
schnell18 / macosx_remove_java9.sh
Created October 8, 2016 13:26
MacOS X remove Java 9
sudo rm -fr /Library/Java/JavaVirtualMachines/jdk-9.jdk/
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefPane
@schnell18
schnell18 / replace_netcat.sh
Last active September 6, 2025 02:17
The nc included in the busybox of Alpine can't be used to do health check reliably as it reports exit code 1 when the server closes immediately (because no data was sent). If you need nc -z to behave “as expected,” replace BusyBox with OpenBSD netcat This gist shows how.
# nc included in the busybox of Alpine can't be used to do health check as it
# reports exit code 1 when the server closes immediately (because no data was sent).
# If you need nc -z to behave “as expected,” replace BusyBox with OpenBSD netcat:
apk add netcat-openbsd # Alpine
apt install netcat-openbsd # Debian/Ubuntu
# Then nc -z localhost 31311 will succeed if the connect() call works.
@schnell18
schnell18 / youtube-video-index-latex.py
Last active May 17, 2025 15:56
This script generates a three-column long table that runs over multiple pages in LaTeX given a two-column time and description text file.
#!/usr/bin/env python
import re
import sys
HEADER = r"""
\documentclass{article}
\usepackage{booktabs,makecell,multirow,threeparttable,diagbox}
\usepackage{longtable}
\usepackage{fancyvrb}
@schnell18
schnell18 / gen_youtube_video_jump_table.py
Created May 9, 2025 05:20
This Python script generate a three-part table in LaTeX to allow user jump to specific point of any long Youtube videos.
#!/usr/bin/env python
import re
import sys
HEADER = r"""
\documentclass{article}
\usepackage{booktabs,makecell,multirow,threeparttable,diagbox}
\usepackage{caption}