Skip to content

Instantly share code, notes, and snippets.

View akhepcat's full-sized avatar

Leif akhepcat

  • Anchorage, AK
View GitHub Profile

Keybase proof

I hereby claim:

  • I am akhepcat on github.
  • I am ak_hepcat (https://keybase.io/ak_hepcat) on keybase.
  • I have a public key whose fingerprint is 1E3E 9937 804A 5948 5328 CE94 9599 700F 08BE EDA8

To claim this, I am signing this object:

@akhepcat
akhepcat / ipcapuniq.sh
Last active May 31, 2017 06:04
a script to tcpdump only uniquely seen IP addresses
#!/bin/bash
DBFILE=ipcapuniq.log
if [ -z "${1}" ]
then
echo "$0 [iface] {expr....}"
exit 1
fi
ifaces=$(ip link show | grep UP | cut -f 2 -d: )
ifaces=$(echo $ifaces)
@akhepcat
akhepcat / force-dkms.sh
Created September 12, 2017 23:48
dkms force builds
#!/bin/bash
for module in $(dkms status | sed 's/, /\//g; s/:.*//g');
do
dkms build $module -k
done
@akhepcat
akhepcat / default.pa
Last active October 21, 2020 19:37
Linux PulseAudio config for split audio channel routing
#!/usr/bin/pulseaudio -nF
.include /etc/pulse/default.pa
# Set up some mono-single-channel maps
load-module module-remap-sink sink_name=Left-to-Mono sink_properties="device.description='Stereo-to-Left-Only'" master=combined channels=2 master_channel_map=left,left channel_map=left,left
load-module module-remap-sink sink_name=Right-to-Mono sink_properties="device.description='Stereo-to-Right-Only'" master=combined channels=2 master_channel_map=right,right channel_map=right,right
@akhepcat
akhepcat / docker-grafana
Created December 13, 2021 20:08
Management script to ensure that grafana-docker stays up-to-date on restart
#!/bin/bash
if [ -n "$(command -v docker)" ]
then
# Check if it's installed at all...
if [ -n "$(docker container ls --all | grep grafana)" ]
then
# it's installed, so first check if it's running...
if [ -n "$(docker container ls | grep grafana)" ]
then
@akhepcat
akhepcat / pkexec
Created January 26, 2022 18:19
replacement pkexec wrapper to log pkexec attempts
#!/bin/bash
# Don't forget to mv /usr/bin/pkexec /usr/bin/pkexec.bin; chmod 0 /usr/bin/pkexec.bin; before using this
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PROG="${0##*/}"
SYSLOG=localhost #change to a remote collector if you have one
PID=$$
cmdline=$(tr '\0' ' ' </proc/$PPID/cmdline | tr -dc '[:print:]')
logger --priority auth.alert -n ${SYSLOG} -t "${PROG}-watch" "called by $USER, PID=$PID, Parent=$PPID, cmdline=[${cmdline}]"
@akhepcat
akhepcat / docker-mgmt.sh
Created February 3, 2022 17:05
Keeping my grafana docker instance up-to-date....
#!/bin/bash
if [ -n "$(command -v docker)" ]
then
# Check if it's installed at all...
if [ -n "$(docker container ls --all | grep grafana)" ]
then
# it's installed, so first check if it's running...
if [ -n "$(docker container ls | grep grafana)" ]
then
@akhepcat
akhepcat / reneg@.service
Created July 20, 2022 21:57
quick network interface renegotiation script and helper
# Install in /etc/systemd/system
# enable as 'reneg@eth0.service' or other interface(s)
#
[Unit]
Description=ethtool configuration to enable 2500mbps speed for the specified card
After=network-online.target
Wants=network-online.target
[Service]
ExecStart=/usr/local/sbin/renegotiate-eth %i
@akhepcat
akhepcat / ntp.conf
Created August 2, 2022 18:26
sanitized config file for ntp+gpsd using ArduSimple RTK-2B on pi3
# /etc/ntpsec/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
# Drift file etc.
# Ensure that the directory exists, and is writable by whichever user
# the ntpd daemon runs as.
driftfile /var/lib/ntpsec/ntp.drift
leapfile /usr/share/zoneinfo/leap-seconds.list
# Enable this if you want statistics to be logged.
statsdir /var/log/ntpsec/
@akhepcat
akhepcat / rockchip-pcie-gen2.d2s
Created May 5, 2023 23:35
Enable PCIe gen2 speeds on RockPro64 boards
/* For RockPro64 boards only!! */
/dts-v1/;
/plugin/;
/ {
fragment@0 {
target-path = "/pcie@f8000000";
__overlay__ {