Skip to content

Instantly share code, notes, and snippets.

View akhepcat's full-sized avatar

Leif akhepcat

  • Anchorage, AK
View GitHub Profile
# This is just some things to do after first boot
# YMMV
#
## First, some local defines
# if you define these, they'll be added as a default connection
SSID=""
WIFIPW=""
@akhepcat
akhepcat / usbreset.c
Created July 10, 2023 22:31
send a USB port reset to a USB device
/* usbreset -- send a USB port reset to a USB device */
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <linux/usbdevice_fs.h>
@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__ {
@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 / [email protected]
Created July 20, 2022 21:57
quick network interface renegotiation script and helper
# Install in /etc/systemd/system
# enable as '[email protected]' 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 / 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 / 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-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 / 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 / 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