Skip to content

Instantly share code, notes, and snippets.

View mstump's full-sized avatar
😀

Matt Stump mstump

😀
View GitHub Profile
@mstump
mstump / blueprint.yaml
Created September 23, 2022 01:33
blueprint for humidity automation
blueprint:
name: Low moisture level detection & notification for all plant sensors
description: Regularly test all plant sensors with 'moisture' crossing
under their threshold.
domain: automation
input:
time:
name: Time to test on
description: Test is run at configured time
default: '10:00:00'
@mstump
mstump / delete_function.jl
Created May 3, 2022 23:44
delete julia function
m = @which flatten_order_infos(DataFrame, order_infos)
Base.delete_method(m)
@mstump
mstump / notes.md
Created March 30, 2022 17:12
X forwarding of an OpenGL application over SSH from Ubuntu/Debian to OSX

Plotting of Makie over and SSH connection using an OSX client

This is known to work when initiating the SSH connection for Terminal or iTerm. Using the terminal from VSCode ssh-remote requires extra steps.

Decent reference for troubleshooting. https://twiki.nevis.columbia.edu/twiki/bin/view/Main/X11OnLaptops

  1. Install XQuartz
  2. On your mac run this command from the terminal defaults write org.xquartz.X11 enable_iglx -bool true. Restart XQuartz if it was running, the setting only takes effect on next use.
  3. SSH to the remote server using the -X and -Y options. The -Y is neccessary to establish trust between the remote server and your X server.
@mstump
mstump / curl.txt
Created January 4, 2022 14:57
curl timing
time_namelookup: %{time_namelookup}s\n
time_connect: %{time_connect}s\n
time_appconnect: %{time_appconnect}s\n
time_pretransfer: %{time_pretransfer}s\n
time_redirect: %{time_redirect}s\n
time_starttransfer: %{time_starttransfer}s\n
----------\n
time_total: %{time_total}s\n
@mstump
mstump / backup.sh
Created December 28, 2020 01:21
restic backup shell script with telegram error and success reporting
#!/bin/bash
source /root/.restic_keys
telegramSend() {
message=$1
telegramStatus=$?
if [[ "$telegramStatus" != 0 ]]; then
echo "Telegram failed to send message: $message"
fi
@mstump
mstump / temp_data.csv
Last active February 9, 2020 21:29
San Francisco Weather Data Courtesy of NOAA CDO
STATION NAME DATE YEAR MONTH WEEK PRCP TMAX TMIN TAVG TAVG_L1 TAVG_L2 TAVG_L3 TAVG_L4
USW00023272 SAN FRANCISCO DOWNTOWN, CA US 1/1/15 2015 1 1 0 54 41 47.5
USW00023272 SAN FRANCISCO DOWNTOWN, CA US 1/2/15 2015 1 1 0 52 42 47 47.5
USW00023272 SAN FRANCISCO DOWNTOWN, CA US 1/3/15 2015 1 1 0 53 42 47.5 47 47.5
USW00023272 SAN FRANCISCO DOWNTOWN, CA US 1/4/15 2015 1 1 0 55 45 50 47.5 47 47.5
USW00023272 SAN FRANCISCO DOWNTOWN, CA US 1/5/15 2015 1 2 0 61 47 54 50 47.5 47 47.5
USW00023272 SAN FRANCISCO DOWNTOWN, CA US 1/6/15 2015 1 2 0 64 49 56.5 54 50 47.5 47
USW00023272 SAN FRANCISCO DOWNTOWN, CA US 1/7/15 2015 1 2 0 67 49 58 56.5 54 50 47.5
USW00023272 SAN FRANCISCO DOWNTOWN, CA US 1/8/15 2015 1 2 0 63 51 57 58 56.5 54 50
USW00023272 SAN FRANCISCO DOWNTOWN, CA US 1/9/15 2015 1 2 0 66 53 59.5 57 58 56.5 54
@mstump
mstump / cassandara_tombstones.promql
Last active February 5, 2020 16:46
Example PromQL query for outliers
# PromQL query looking for outliers in Cassandra tombstone activity
# (mean tombstones scanned in Cassandra - the rolling average of the same value)
# divided by the standard deviation
(
( mean_tombstones_scanned_avg{service="CASSANDRA"}
- avg_over_time(mean_tombstones_scanned_avg{service="CASSANDRA"}[1d])
)
/ (stddev_over_time(mean_tombstones_scanned_avg{service="CASSANDRA"}[1d]))
)
@mstump
mstump / index.json
Last active July 19, 2019 16:28
m3 index bug
[
{
"registry": {
"namespaces": {
"default": {
"bootstrapEnabled": true,
"cleanupEnabled": true,
"coldWritesEnabled": false,
"flushEnabled": true,
"indexOptions": {
#!/bin/bash
echo "deb http://ftp.de.debian.org/debian testing main" >> /etc/apt/sources.list
echo 'APT::Default-Release "stable";' | tee -a /etc/apt/apt.conf.d/00local
apt-get update
apt-get -t testing -y install python3.7 python-dev build-essential python3-pip
easy_install3 -U pip
# Install requirements
pip3 install --upgrade google-cloud
@mstump
mstump / historical_page_views.py
Last active April 23, 2019 11:39
Python Faust with an expiring cache reading from historical data, also using protobuf3 as the serializer
import asyncio
import calendar
import faust
import itertools
import random
import signal
import string
import time
import uuid