Skip to content

Instantly share code, notes, and snippets.

View tylerszabo's full-sized avatar

Tyler Szabo tylerszabo

View GitHub Profile
@tylerszabo
tylerszabo / ip_list.php
Created February 24, 2022 04:32
Get IPv6 address for MAC on PFSense
<?php
/* ip_list.php
*
* Copyright (c) 2022 Tyler Szabo
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@tylerszabo
tylerszabo / average_indoor_temperature.yaml
Last active February 23, 2022 02:48
Home Assistant Average Indoor Temperature Sensor
- sensor:
- unique_id: sensor.indoor_temperature_average
name: "Average Indoor Temperature"
unit_of_measurement: "°C"
device_class: temperature
state_class: measurement
state: >
{%- set input_group = expand('group.sensors_temperature_indoor') -%}
{%- set temperatures = input_group|map(attribute='state')|map('float',undefined)|select('defined')|list -%}
{%- if temperatures|length() <= 0 -%}
@tylerszabo
tylerszabo / noise.sh
Created October 4, 2021 19:53
Play background noise
ffplay -f lavfi -i anoisesrc=amplitude=0.1:color=pink -nodisp
@tylerszabo
tylerszabo / expected_humidity.yaml
Last active August 2, 2021 03:24
Home Assistant Expected Indoor Humidity computation
# Use Arden Buck equation <https://en.wikipedia.org/wiki/Arden_Buck_equation> to compute approximate expected indoor humidty given outdoor humidity
template:
- sensor:
unique_id: "tylerszabo/template.sensor:expected-indoor-humidity"
name: "Expected Indoor Humidity"
unit_of_measurement: "%"
device_class: humidity
state: >
{%- set t0 = states('sensor.outdoor_temperature')|float(undefined) -%}
@tylerszabo
tylerszabo / fitocracy_export.js
Created January 24, 2021 06:26
Output Fitocracy CSV
// Run the following on the Performance report on your Profile page: https://www.fitocracy.com/profile/<username>/?performance
(function(){
var z_history = $('#history_activity_chooser')[0];
var z_promises = [];
for (var i = 0; i < z_history.options.length; i++) {
z_promises.push(load_chart(z_history.options[i].value, z_history.options[i].innerText));
}
@tylerszabo
tylerszabo / createuser.sh
Last active January 3, 2021 08:01
A litte wrapper for `useradd`
#!/usr/bin/env sh
set -e
if [ -n "$1" -a -n "$2" ]; then
ID_ARGS="--key UID_MIN=$1 --key UID_MAX=$1 --key GID_MIN=$1 --key GID_MAX=$1"
NEW_USER=$2
else
echo "Usage: $0 ID NAME" >&2
exit 1
@tylerszabo
tylerszabo / xmas.vim
Last active December 21, 2020 01:37
A silly script to add color to "Christmas", "X-Mas", and "Noël"
" A silly script to add color to "Christmas", "X-Mas", and "Noël"
"
" Install into ~/.vim/plugin and enjoy festive editing in December.
"
" Author: Tyler Szabo
" Last Update: 2020-12-20
"
" This is free and unencumbered software released into the public domain.
"
" Anyone is free to copy, modify, publish, use, compile, sell, or
@tylerszabo
tylerszabo / ChkSysFiles_RO.cmd
Last active December 11, 2020 11:12
Check system files without making changes
SFC /VerifyOnly
DISM /Online /Cleanup-Image /ScanHealth
ChkDsk %SystemDrive% /Scan
<#
.SYNOPSIS
Output Windows Terminal color scheme JSON from a ColorTool .INI scheme
.DESCRIPTION
Until a new release of ColorTool that contains the update to output Windows Terminal JSON schemes it'll either need to be built locally or .INI schemes converted. This script accomplishes the convesrion of ColorTool .INI schemes for Windows Termianl.
.PARAMETER Path
Path to a ColorTool scheme .INI file
.LINK
https://github.com/microsoft/terminal
.LINK
@tylerszabo
tylerszabo / run-jessfraz-firefox.ps1
Last active April 1, 2021 02:25
Run Jess Frazelle's Firefox container on Docker for Windows
docker run --rm -e DISPLAY=host.docker.internal:0 -e LIBGL_ALWAYS_INDIRECT=1 jessfraz/firefox:latest
# Requires VcXsrv (https://chocolatey.org/packages/vcxsrv)