Skip to content

Instantly share code, notes, and snippets.

// Name: Find JIRA ticket
// Shortcode: j
import "@johnlindquist/kit"
const JIRA_URL = await env("JIRA_URL");
const JIRA_USERNAME = await env("JIRA_USERNAME");
const JIRA_PASSWORD = await env("JIRA_PASSWORD");
const JIRA_PROJECT_KEY = await env("JIRA_PROJECT_KEY");
// Name: Get Departures
import "@johnlindquist/kit"
type Station = { id: string, name: string, type: string };
async function departuresDom(station: Station): Promise<string> {
const now = new Date();
const body = {
"version": 47,
theme = "onedark"
[editor]
line-number = "relative"
color-modes = true
[editor.file-picker]
hidden = false
[editor.indent-guides]
@vigonotion
vigonotion / export_as_primitive.py
Created June 25, 2019 17:31
Blender script to export as a geometry for three.js
import bpy, os
result = ""
obdata = bpy.context.object.data
result += 'Vertices: \n'
for v in obdata.vertices:
result += ('{}, {}, {}, '.format(v.co.x, v.co.z, v.co.y)) + '\n'
@vigonotion
vigonotion / dijkstra.py
Created June 22, 2018 09:12
shortest path algorithm (dijkstra) with python
# The Path class
class Path:
def __init__(self, knot0, knot1, metric, sort=False):
self.knot0 = knot0
self.knot1 = knot1
self.metric = metric
def other(self, knot):
if self.knot0 == knot:
return self.knot1
class HvvDeparturesCard extends HTMLElement {
set hass (hass) {
const entityId = this.config.entity
const state = hass.states[entityId]
const name = this.config.name || state.attributes['friendly_name']
if (!this.content) {
const card = document.createElement('ha-card')
card.header = name
this.content = document.createElement('div')
button_card_templates:
homekit:
aspect_ratio: 1/1
hold_action:
action: more-info
show_label: true
show_state: true
color_type: card
color: '#232321'
size: 28px
[{"id":"6e393969.673f5","type":"server-state-changed","z":"974a0bef.a0e068","name":"Someone comes 🏠","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"person\\..*","entityidfiltertype":"regex","outputinitially":false,"state_type":"str","haltifstate":"home","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":110,"y":620,"wires":[["49d067bc.f7f448"],[]]},{"id":"49d067bc.f7f448","type":"delay","z":"974a0bef.a0e068","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":235,"y":620,"wires":[["e01bf48d.d8b98"]],"l":false},{"id":"e01bf48d.d8b98","type":"function","z":"974a0bef.a0e068","name":"Filter family","func":"let family = ['person.alice', 'person.bob', 'person.celine', 'person.dylan'];\n\nif(family.includes(msg.topic)) {\n node.status({fill:\"
@vigonotion
vigonotion / campfire-orange.yaml
Created April 26, 2020 17:20
Theme for Home Assistant
# Main colors
primary-color: '#ffb430' #322a65
accent-color: '#ffb430' #312868
#dark-primary-color: '#2980b9'
light-primary-color: '#fff6e6'
#mdc-theme-primary: '#e971ae'
# Backgrounds
lovelace-background: 'center / cover no-repeat url("/local/background.jpg?v=1") fixed'
from zigpy.profiles import PROFILES, zha
from zigpy.zcl.clusters.general import Basic, Identify,\
Ota, PowerConfiguration, Time, Groups
from zigpy.zcl.clusters.hvac import Thermostat
from zigpy.quirks import CustomDevice, CustomCluster
import zigpy.types as types
from zigpy.zcl import foundation
THERMOSTAT_CHANNEL = 'thermostat'