Skip to content

Instantly share code, notes, and snippets.

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 / i2c-trace.txt
Created Aug 30, 2020
Kernel i2c trace of Meraki poe_server through several port operations
View i2c-trace.txt
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
@halmartin
halmartin / bootlog_ms220_20200722.txt
Created Jul 22, 2020
MS220 postmerkOS bootlog 2020-07-22
View bootlog_ms220_20200722.txt
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
View gist:cb46654b8f386241f675554fd4565600
# 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 / gist:6ee8b1f6d5735f96f17cb8f13cc290f3
Created Jul 22, 2020
MS42 /click/switch_port_table/dump_pports
View gist:6ee8b1f6d5735f96f17cb8f13cc290f3
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
@halmartin
halmartin / switch_brain_strace.txt
Created Jun 24, 2020
strace of switch_brain running on a Meraki MS220-8P (modified firmware)
View switch_brain_strace.txt
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
@halmartin
halmartin / boot-hostsailor.py
Last active Jun 3, 2020
Automate (re)booting a HostSailor instance
View boot-hostsailor.py
#!/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
View config-3.18.123-ttyprintk
#
# 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.py
Created Feb 5, 2018
MicroPython boot.py file, used on Wemos D1 mini temperature sensor
View boot.py
# 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 Jun 3, 2018
MicroPython for Wemos D1 mini to read temperature/humidity and report to InfluxDB
View th_wemos-5a0385.py
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 / temperature_S1200BTL.sh
Last active Jan 22, 2018
FreeBSD: collectd metrics for Intel S1200BTL CPU, BMC, and PSU
View temperature_S1200BTL.sh
#!/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
You can’t perform that action at this time.