Skip to content

Instantly share code, notes, and snippets.

View Klathmon's full-sized avatar

Gregory Benner Klathmon

View GitHub Profile
@Klathmon
Klathmon / ge_double.yaml
Created September 7, 2022 13:45 — forked from kpine/ge_double.yaml
GE/Jasco Double Tap Generic Blueprint
blueprint:
name: GE Enbrighten Switch Double Taps
description: Create automations to react to double taps from supporting GE switches.
domain: automation
input:
device:
name: Switch Device
description: A GE switch that supports double taps.
selector:
@Klathmon
Klathmon / PrintIncludedFilenamesPlugin.js
Created February 3, 2021 16:48
PrintIncludedFilenamesPlugin
class PrintIncludedFilenamesPlugin {
apply(compiler) {
compiler.plugin('compilation', compilation => {
compilation.plugin('after-optimize-chunk-assets', chunks => {
for (const chunk of chunks) {
for (const module of chunk.getModules()) {
if (module.resource) {
// further filter files depending on filename or module type
console.log(module.resource);
}
#!/bin/bash
# Usage: clone_all_repos.sh [organization] <output directory>
# must have jq installed (brew install jq or apt install jq)
ORG="lanetix"
PER_PAGE=100
GIT_OUTPUT_DIRECTORY=${2:-"."}
# Go to https://github.com/settings/tokens and generate a new github token, make sure to give it access to all repo permissions, then paste the token below
GITHUB_TOKEN="TOKEN_GOES_HERE"
@Klathmon
Klathmon / bassoon.js
Created May 1, 2020 20:30
super unfinished playing around with oboe and react concurrent/suspense for data fetching
import DeepProxy from 'proxy-deep'
import oboe from 'oboe'
const PENDING = Symbol('PENDING')
const SUCCESS = Symbol('SUCCESS')
const ERROR = Symbol('ERROR')
export default function bassoon (...args) {
const state = new Map()
const oboeRequest = oboe(...args)
@Klathmon
Klathmon / advLock.js
Created April 17, 2020 15:57
advisory lock in postgres snippet
export default async function advLock (query, lockId, transaction) {
try {
await query(`SELECT pg_advisory_lock($1)`, [lockId])
// the `return await` is important, it ensures we await in this function
// and catch any errors here so the finally runs AFTER the promise resolves/rejects
return await transaction()
} finally {
// it's really important we don't return here, otherwise we will overwrite
// the return value from above
@Klathmon
Klathmon / part2
Created October 24, 2019 17:59
part2
{
"table": "video_games",
"select": [
"id",
"name",
"genre"
],
"filter": {
"type": "or",
"left": {
@Klathmon
Klathmon / bdn9-keymap.c
Last active August 13, 2019 19:34
asdf
/* Copyright 2019 Danny Nguyen <danny@keeb.io>
* Copyright 2019 Gregory Benner <gregbenner1@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
# generated by Slic3r Prusa Edition 1.42.0-beta2+win64 on 2019-04-25 at 18:00:51
[filament:Black Hatchbox]
bed_temperature = 55
bridge_fan_speed = 100
compatible_printers =
compatible_printers_condition = printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/
compatible_prints =
compatible_prints_condition =
cooling = 1
@Klathmon
Klathmon / variables.js
Last active September 11, 2018 15:18
nativebase variables.js
import color from "color";
import { Platform, Dimensions, PixelRatio } from "react-native";
const deviceHeight = Dimensions.get("window").height;
const deviceWidth = Dimensions.get("window").width;
const platform = Platform.OS;
const platformStyle = "material";
const isIphoneX =
platform === "ios" && deviceHeight === 812 && deviceWidth === 375;
@Klathmon
Klathmon / init.coffee
Last active March 4, 2019 13:45
Atom Sync Settings
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->