Skip to content

Instantly share code, notes, and snippets.

@kelchm
kelchm / bulk-rename-entities.sh
Created April 1, 2023 11:40
hass-cli examples
#!/bin/bash
for i in $(hass-cli entity list "living_room_recessed_lights*" |awk '{print $1}' | grep -v ENTITY_ID)
do
NEW_ID=$(echo $i | sed 's/living_room_recessed_lights/living_room_fireplace_recessed_lights/')
echo "hass-cli entity rename ${i} ${NEW_ID}"
# hass-cli entity rename ${i} ${NEW_ID}
done
❯ nrfutil settings display nrf-cgg1-stock-1.1.2_0020.hex
Bootloader DFU Settings:
* File: nrf-cgg1-stock-1.1.2_0020.hex
* Family: nRF52
* Start Address: 0x00000000
* CRC: 0x4EE9A698
* Settings Version: 0x00000001 (1)
* App Version: 0x000000FF (255)
* Bootloader Version: 0x00000000 (0)
@kelchm
kelchm / machine.js
Created May 20, 2020 15:24
Generated by XState Viz: https://xstate.js.org/viz
const hasDelinquencies = () => true;
const hasInsufficientFunds = () => false;
const generateDisqualificationStates = (name, condition) => ({
[name]: {
initial: 'evaluating',
states: {
evaluating: {
on: {
EVALUATE_DISQUALIFICATION: [
@kelchm
kelchm / machine.js
Last active May 8, 2020 21:57
Generated by XState Viz: https://xstate.js.org/viz
const hasDelinquencies = () => true;
const hasInsufficientFunds = () => false;
const financialPlanMachine = Machine({
id: 'financialPlan',
initial: 'checkingForDisqualification',
states: {
checkingForDisqualification: {
on: {
FINISH_DISQUALIFICATION: [
@kelchm
kelchm / codegen.js
Last active June 18, 2019 03:30
babel-plugin-codgen dynamic named exports troublshooting
const questionFactory = require('./questionFactory');
const generalQuestionConfig = require('./generalConfig');
const processedConfig = questionFactory('general', generalQuestionConfig);
module.exports = Object.keys(processedConfig)
.map(key => `export const ${key} = ${JSON.stringify(processedConfig[key])}`)
.join(';');
@kelchm
kelchm / docker-compose.yml
Created August 16, 2017 13:32
Consul Sample
version: '2'
services:
consul:
image: consul:latest
stdin_open: true
tty: true
ports:
- 8500/tcp
command:
- consul
variables:
COMPOSE_FILE: "docker-compose.rancher.yml"
TRAEFIK_ENABLED: "true"
STACK_NAME: $CI_PROJECT_NAME-$CI_COMMIT_REF_SLUG
stages:
- build
- deploy
- cleanup
@kelchm
kelchm / docker-compose.yml
Created February 24, 2017 20:08
Self-Registration of GitLab Runners within Rancher
version: '2'
services:
gitlab-runner-config:
image: gitlab/gitlab-runner:alpine
stdin_open: true
volumes:
- /etc/gitlab-runner/
tty: true
command:
- register
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format "
xmlns:urldecoder="xalan://java.net.URLDecoder"
exclude-result-prefixes="urldecoder">
<xsl:output method="text" media-type="application/json" encoding="ISO-8859-1"/>
<!-- Load the column titles and fieldnames into a variable for later use. -->
G28 X Y ; home X and Y axes
G30 Z0 ; home Z axis
G92 E0 ; zero the extruded length
G1 Y175 Z5 F12000 E20
G1 Y150 Z0 F12000
G1 Y50 F12000
G1 Y0 Z10
G92 E0 ; reset extruder