Skip to content

Instantly share code, notes, and snippets.

View halmartin's full-sized avatar
💭
I void warranties and ask companies for their GPL source code.

Hal Martin halmartin

💭
I void warranties and ask companies for their GPL source code.
View GitHub Profile
@halmartin
halmartin / temperature_S1200BTL.sh
Last active January 22, 2018 11:11
FreeBSD: collectd metrics for Intel S1200BTL CPU, BMC, and PSU
#!/bin/sh
HOSTNAME="${COLLECTD_HOSTNAME:-`hostname -f`}"
INTERVAL="${COLLECTD_INTERVAL:-30}"
while sleep "$INTERVAL"; do
/sbin/sysctl -a | awk -F'[. ]' '/dev\.cpu\.[0-9]\.temperature/ {printf "%s %s\n",$3,$5}'|while read c t
do
echo "PUTVAL \"$HOSTNAME/temperature/temperature-cpu${c}\" interval=$INTERVAL N:${t%%.*}"
done
@halmartin
halmartin / boot.py
Created February 5, 2018 18:33
MicroPython boot.py file, used on Wemos D1 mini temperature sensor
# This file is executed on every boot (including wake-boot from deepsleep)
import gc
gc.collect()
# connect to WiFi
import network
sta_if = network.WLAN(network.STA_IF)
sta_if.active(True)
sta_if.connect("MySSID","P4ssw0rd!")
from time import sleep
@halmartin
halmartin / th_wemos-5a0385.py
Last active June 3, 2018 13:27
MicroPython for Wemos D1 mini to read temperature/humidity and report to InfluxDB
import urequests
from time import sleep
from machine import Pin, reset
p2 = Pin(2, Pin.OUT)
HOST="wemos-5a0385"
LENGTH=60
def TempSensReport():
from sht30 import SHT30
@halmartin
halmartin / config-3.18.123-ttyprintk
Created May 2, 2020 19:53
Linux 3.18.123 .config
#
# Automatically generated file; DO NOT EDIT.
# Linux/mips 3.18.123 Kernel Configuration
#
CONFIG_MIPS=y
#
# Machine selection
#
# CONFIG_MIPS_ALCHEMY is not set
@halmartin
halmartin / boot-hostsailor.py
Last active June 3, 2020 12:19
Automate (re)booting a HostSailor instance
#!/usr/bin/env python3
# Copyright (C) 2020 Hal Martin
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@halmartin
halmartin / switch_brain_strace.txt
Created June 24, 2020 18:09
strace of switch_brain running on a Meraki MS220-8P (modified firmware)
This file has been truncated, but you can view the full file.
/ # strace -E LD_LIBRARY_PATH=/opt/lib -v -s 1024 /opt/bin/switch_brain
execve("/opt/bin/switch_brain", ["/opt/bin/switch_brain"], ["USER=root", "SHLVL=1", "HOME=/", "TERM=vt100", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", "SHELL=/bin/sh", "PWD=/", "LD_LIBRARY_PATH=/opt/lib"]) = 0
set_thread_area(0x77328ec0) = 0
set_tid_address(0x77321e28) = 404
open("/opt/lib/libmeraki.so", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
fcntl64(3, F_SETFD, FD_CLOEXEC) = 0
fstat64(3, {st_dev=makedev(0x1f, 0x3), st_ino=215, st_mode=S_IFREG|0755, st_nlink=1, st_uid=0, st_gid=0, st_blksize=1024, st_blocks=2560, st_size=1310343, st_atime=1591549954 /* 2020-06-07T17:12:34+0000 */, st_atime_nsec=0, st_mtime=1591549954 /* 2020-06-07T17:12:34+0000 */, st_mtime_nsec=0, st_ctime=1591549954 /* 2020-06-07T17:12:34+0000 */, st_ctime_nsec=0}) = 0
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\10\0\1\0\0\0p]\2\0004\0\0\0\0\0\0\0\7\20\0p4\0 \0\t\0\0\0\0\0\0\0\3\0\0pX\1\0\0X\1\0\0X\1\0\0\30\0\0\0\30\0\0\0\4\0\0\0\10\0\0\0\0\0\0p
@halmartin
halmartin / gist:6ee8b1f6d5735f96f17cb8f13cc290f3
Created July 22, 2020 17:19
MS42 /click/switch_port_table/dump_pports
port up mbps fdx aggrnum aggr_enabled pcap neighbor_state sflow hw_en stk trusted storm_ctrl isolated
1 1 1000 1 -1 0 0 other 1 1 0 0 1 0
2 0 0 0 -1 0 0 other 1 1 0 0 1 0
3 0 0 0 -1 0 0 other 1 1 0 0 1 0
4 0 0 0 -1 0 0 other 1 1 0 0 1 0
5 0 0 0 -1 0 0 other 1 1 0 0 1 0
6 0 0 0 -1 0 0 other 1 1 0 0 1 0
7 0 0 0 -1 0 0 other 1 1 0 0 1 0
8 0 0 0 -1 0 0 other 1 1 0 0 1 0
9 0 0 0 -1 0 0 other 1 1 0 0 1
# ethtool eth0
Settings for eth0:
Supported ports: [ FIBRE ]
Supported link modes: 10000baseT/Full
Supported pause frame use: Symmetric
Supports auto-negotiation: No
Supported FEC modes: Not reported
Advertised link modes: 10000baseT/Full
Advertised pause frame use: Symmetric
Advertised auto-negotiation: No
@halmartin
halmartin / bootlog_ms220_20200722.txt
Created July 22, 2020 20:56
MS220 postmerkOS bootlog 2020-07-22
LinuxLoader built Nov 12 2002 18:01:50
init_pll ok
init_spi ok
init_memctl ok
wait_memctl ok
Training DRAM ok
init_irq ok
init_dram_uncached ok
init_icache ok
init_dcache ok
@halmartin
halmartin / i2c-trace.txt
Created August 30, 2020 10:17
Kernel i2c trace of Meraki poe_server through several port operations
This file has been truncated, but you can view the full file.
# tracer: nop
#
# entries-in-buffer/entries-written: 6616/6616 #P:1
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION