Skip to content

Instantly share code, notes, and snippets.

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
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')
@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
@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'
theme = "onedark"
[editor]
line-number = "relative"
color-modes = true
[editor.file-picker]
hidden = false
[editor.indent-guides]
// 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,
// 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");