Skip to content

Instantly share code, notes, and snippets.

View gwww's full-sized avatar

Glenn Waters gwww

  • Ottawa, Canada
View GitHub Profile
@gwww
gwww / migration.md
Last active February 17, 2024 17:37
Quick share point for migration guide... just to see progress.
@gwww
gwww / disable-entities
Last active March 4, 2024 18:45
Script and config to disable Home Assistant entities and to "template" configurate an MQTT device
#!python3
# Based on: https://community.home-assistant.io/t/api-for-changing-entities/282114/3
import asyncio
import json
import os
import re
import sys
import yaml # type: ignore
import websockets
@gwww
gwww / init.lua
Created March 22, 2021 23:59
Test init.lua to test tree-sitter
-------------------- HELPERS -------------------------------
local api, cmd, fn, g = vim.api, vim.cmd, vim.fn, vim.g
local execute = vim.api.nvim_command
local scopes = {o = vim.o, b = vim.bo, w = vim.wo}
local function map(mode, lhs, rhs, opts)
local options = {noremap = true}
if opts then options = vim.tbl_extend('force', options, opts) end
api.nvim_set_keymap(mode, lhs, rhs, options)
end
@gwww
gwww / new-link-down-event.sh
Last active February 5, 2021 05:17
Monitor OPNSense log file for link DOWN. For integration with Monit.
@gwww
gwww / gist:eef5fdf7fc7774e52e397ec1d34c00e9
Created October 22, 2018 01:21 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@gwww
gwww / pe.zsh
Last active April 17, 2018 02:09
Wrapper for pipenv that adds activate and deactivate commands.
# Small wrapper around pipenv to provide activate/deactivate commands
function pe() {
if [[ $# = 1 && ${#1} > 1 ]]; then
if [[ 'activate' =~ "^$1" ]]; then
local venv="$(pipenv --venv 2> /dev/null)"
if [ -n "$venv" ]; then
echo "Activating '$venv'"
source $venv/bin/activate
else
echo "No virtual environment for this directory"
@gwww
gwww / _config.yml
Created February 1, 2016 15:55
Stylus Jekyll plugin
# Optional stylus section
# 'command' defaults to 'stylus' if not present
# 'options' default to blank if not present
# 'options' are a YAML String
stylus:
command: ./node_modules/stylus/bin/stylus
options:
--include ./css
--include ./node_modules/nib/lib
@gwww
gwww / finder.rb
Created October 30, 2014 20:21
UIA spike to for "custom" locator
require 'uia/library/win32'
module Uia
class BadLocator < StandardError
def initialize(locator)
super "#{locator} is not a valid locator"
end
end
class BadChildLocator < BadLocator; end