Skip to content

Instantly share code, notes, and snippets.

@xanderlent
xanderlent / show_all_cpu_hw_vulns.sh
Created December 30, 2022 19:17
A bash script to show all CPU Hardware Security Vulnerabilities that Linux reports information on
#!/bin/bash
# This is a little script that I keep re-writing whenever I need it.
# I suppose that means it's time to write it down!
for vuln in /sys/devices/system/cpu/vulnerabilities/*; do echo "$(basename $vuln): $(cat $vuln)"; done
@xanderlent
xanderlent / generate_ula.py
Last active June 28, 2023 12:41
IPv6 ULA Random Prefix Generator (Python one-liner)
import secrets; prefix = list("fd" + secrets.randbits(40).to_bytes(5, "big").hex() + "::/48"); prefix.insert(4, ":"); prefix.insert(9, ":"); print("".join(prefix))
@xanderlent
xanderlent / Joyent Gerrit Bug Link Rewriter.user.js
Last active January 2, 2020 05:57
Rewrites internal JIRA links on the Joyent Gerrit instance to public bugview links
@xanderlent
xanderlent / index.md
Created May 21, 2019 03:17
Ethernet OUIs from the command line

Ethernet OUIs from the command line

(Something I cooked up out of curiosity on 2019-05-20...)

You want a list of OUIs?
Have a list of (Ethernet) OUIs (on Linux): ip l | grep link/ether | tr -s ' ' '\t' | cut -f 3 | cut -d: -f 1-3
or ifconfig | grep HWaddr | tr -s ' ' | cut -d ' ' -f 5 | cut -d: -f 1-3

Here’s macOS: ifconfig | grep ether | tr ' ' '\t' | cut -f 3 | cut -d: -f 1-3

@xanderlent
xanderlent / fanmax.service
Last active June 28, 2023 12:44
systemd service to run MacBook Pro fans at maximum, tested on a MacBookPro11,3
[Unit]
Description=Max out MacBook Pro fans
[Service]
Type=oneshot
RemainAfterExit=True
ExecStart=/bin/bash -c "echo 1 > /sys/devices/platform/applesmc.768/fan1_manual"
ExecStart=/bin/bash -c "cat /sys/devices/platform/applesmc.768/fan1_max > /sys/devices/platform/applesmc.768/fan1_output"
ExecStart=/bin/bash -c "echo 1 > /sys/devices/platform/applesmc.768/fan2_manual"
ExecStart=/bin/bash -c "cat /sys/devices/platform/applesmc.768/fan2_max > /sys/devices/platform/applesmc.768/fan2_output"
ExecStop=/bin/bash -c "echo 0 > /sys/devices/platform/applesmc.768/fan1_manual"