Skip to content

Instantly share code, notes, and snippets.

View larsks's full-sized avatar

Lars Kellogg-Stedman larsks

View GitHub Profile
-- Description:
-- ------------
--
-- This is an example schema for storing collectd metrics in a TimescaleDB
-- dabase (see https://www.timescale.com/). It is based on the PostgreSQL
-- schema contributed by Sebastian Harl.
--
-- Prerequisities:
-- ---------------
--
1 146.82500 146.22500 0.60000 -RPT FM ON MRABBY TONE 67.0 Hz 023 1500 Hz MID YES 5.0KHz OFF OFF 0
2 146.61000 146.01000 0.60000 -RPT FM ON MRMDN TONE 146.2 Hz 023 1500 Hz MID YES 5.0KHz OFF OFF 0
3 146.67000 146.07000 0.60000 -RPT FM ON MRAQCY TONE 146.2 Hz 023 1500 Hz MID YES 5.0KHz OFF OFF 0
4 146.71500 146.11500 0.60000 -RPT FM ON MRANRD TONE 146.2 Hz 023 1500 Hz MID YES 5.0KHz OFF OFF 0
5 146.79000 146.19000 0.60000 -RPT FM ON MRAWES TONE 146.2 Hz 023 1500 Hz MID YES 5.0KHz OFF OFF 0
6 147.12000 147.72000 0.60000 +RPT FM ON MRABCA TONE 146.2 Hz 023 1500 Hz MID YES 5.0KHz OFF OFF 0
7 147.27000 147.87000 0.60000 +RPT FM ON MRAMRW TONE 146.2 Hz 023 1500 Hz MID YES 5.0KHz OFF OFF 0
8 442.25000 447.25000 5.00000 +RPT FM ON MRALWL TONE 88.5 Hz 023 1500 Hz MID YES 12.5KHz OFF OFF 0
9 442.70000 447.70000 5.00000 +RPT FM ON MRAHB2 TONE 88.5 Hz 023 1500 Hz MID YES 12.5KHz OFF OFF 0
10 446.77500 441.77500 5.00000 -RPT FM ON MRANRD TONE 88.5 Hz 023 1500 Hz MID YES 12.5KHz OFF OFF 0
@larsks
larsks / fibtrace.bt
Last active August 23, 2024 05:04
Track routing decisions made by fib_validate_source
kprobe:fib_validate_source {
$skb = (struct sk_buff*) arg0;
@skb[tid] = $skb;
@ipheader[tid] = ((struct iphdr *) ($skb->head + $skb->network_header));
}
kretprobe:fib_validate_source {
$skb = @skb[tid];
$ipheader = @ipheader[tid];
$version = $ipheader->version;
# GDB scripts for working with Linux ax.25 subsystem
define ax-devs
set $x = ax25_dev_list
while ($x != 0)
printf "%s axdev:%d dev_refcnt:%d dev_untracked:%d dev_notrack:%d\n", $x->dev->name, \
$x->refcount->refs->counter, \
$x->dev->dev_refcnt->refs->counter, \
$x->dev->refcnt_tracker->untracked->refs->counter, \
$x->dev->refcnt_tracker->no_tracker->refs->counter
@larsks
larsks / ax25_relase_uaf.txt
Last active April 17, 2024 13:39
Linux AX.25 Bugs
Apr 17 09:38:03 radio1.local kernel: ------------[ cut here ]------------
Apr 17 09:38:03 radio1.local kernel: WARNING: CPU: 0 PID: 3750 at lib/refcount.c:28 ax25_release+0x358/0x36c [ax25]
Apr 17 09:38:03 radio1.local kernel: refcount_t: underflow; use-after-free.
Apr 17 09:38:03 radio1.local kernel: Modules linked in: tun tcp_diag inet_diag mkiss overlay cmac algif_hash aes_arm_bs crypto_simd cryptd algif_skcipher af_alg bnep vc4 snd_soc_hdmi_codec drm_display_helper cec drm_dma_helper drm_kms_helper brcmfmac_wcc snd_soc_core hci_uart btbcm bluetooth brcmfmac cp210x snd_compress usbserial raspberrypi_hwmon snd_pcm_dmaengine snd_usb_audio bcm2835_codec(C) v4l2_mem2mem brcmutil snd_hwdep snd_usbmidi_lib bcm2835_v4l2(C) bcm2835_isp(C) cfg80211 bcm2835_mmal_vchiq(C) videobuf2_dma_contig videobuf2_vmalloc videobuf2_memops snd_rawmidi snd_bcm2835(C) videobuf2_v4l2 binfmt_misc snd_seq_device videodev snd_pcm snd_timer snd videobuf2_common ecdh_generic ecc rfkill mc vc_sm_cma(C) raspberrypi_gpiomem uio_pdrv_genirq
#!/bin/bash
# Split a certificate bundle into individual certificates.
#
# This will produce files named `cert-000.crt`, `cert-001.crt`, .etc.
read -r count < <(csplit -z "$1" -f cert- -b '%03d.crt' '/^-----BEGIN CERTIFICATE-----/' '{*}' | wc -l)
echo "split $count certificates"
@larsks
larsks / boot.sh
Created September 6, 2022 02:24
Booting raspberry pi 64 bit using qemu
#!/bin/sh
SERIAL1=( -chardev stdio,id=uart1 -serial chardev:uart1 -monitor none )
SERIAL2=( -serial vc -serial vc )
SERIAL3=( -nographic -serial mon:stdio )
EMU_RASPI=( -M raspi3 )
EMU_VIRT=( -M virt -cpu cortex-a72 )
NET_TAP=(
@larsks
larsks / README.md
Last active January 29, 2024 16:49
CS50 PS2 solution with tests

A couple of solutions to CS50 problem 2 ("vanity plates") along with a simple test suite.

# extlinux.conf generated by anaconda
ui menu.c32
menu autoboot Welcome to Fedora. Automatic boot in # second{,s}. Press a key for options.
menu title Fedora Boot Options.
menu hidden
timeout 50
#totaltimeout 9000
@larsks
larsks / windows-core-setup.md
Created November 2, 2012 02:13
Setting up Windows Server Core

Initial configuration

  • Set the timezone

      tzutil /s "Eastern Standard Time"
    
  • Enable automatic updates:

      cscript \windows\system32\scregedit.wsf /AU 4