Moved from Gist to PR. See AstroNvim/docs#138
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-------------------- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
lastlog_file="/home/admin/link-down/lastlog.txt" | |
history_file="/home/admin/link-down/history.txt" | |
down_logs="clog /var/log/system.log | grep 'link state changed to DOWN$'" | |
last_log=`eval $down_logs | tail -1` | |
if [ ! -e $lastlog_file ]; then | |
echo "$last_log" >$lastlog_file | |
touch -A -235959 $lastlog_file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |