Skip to content

Instantly share code, notes, and snippets.

@thomasjonas
thomasjonas / turn-off-lights.sh
Created September 9, 2019 16:19
Bash script to turn off all Philips Hue Lights
# This script requires jq (https://stedolan.github.io/jq/) for JSON parsing. Would be great to get rid of that dependency.
# Besides that you need to create an API user for you Philips Hue Bridge as described here:
# https://developers.meethue.com/develop/get-started-2/#so-lets-get-started
#!/bin/bash
HUE_API_ADDRESS=IP_ADDRESS_OF_HUE_GOES_HERE
HUE_API_USER=USER_OF_HUE_API_GOES_HERE
LIGHTS=$(curl -s http://$HUE_API_ADDRESS/api/$HUE_API_USER/lights | jq 'keys[]')
@thomasjonas
thomasjonas / Dockerfile
Last active May 4, 2024 17:39
Dokku Dockerfile deployment for Create React App
# DISCLAIMER: This is probably not the best way to do it. This is just one way to make it work.
# There's 2 stages:
# - building the app
# - serving the app
# Build step
FROM node:10 as builder
# in case you want to use ENV variables you need to provide them as build-time configuration arguments

Keybase proof

I hereby claim:

  • I am thomasjonas on github.
  • I am thomasjonas (https://keybase.io/thomasjonas) on keybase.
  • I have a public key ASCCALs8psJogq-Fsj8hsv_lWaj3NGWAetQycDhwaJy8KQo

To claim this, I am signing this object:

@thomasjonas
thomasjonas / example.jsx
Created September 15, 2016 21:25
intersperse with a jsx element
/* intersperse: Return an array with the separator interspersed between
* each element of the input array.
*
* > _([1,2,3]).intersperse(0)
* [1,0,2,0,3]
*/
function intersperse(arr, sep) {
if (arr.length === 0) {
return [];
}
/*
* fonts.com implement one different font-family name per weight or style of
* the same font. This means you need to explicitly declare in your elements
* that use a font-weight different to `normal`, the new font-family
* corresponding to that weight.
*
* See http://stackoverflow.com/questions/5824925/is-there-any-way-to-fix-fonts-com-font-face-declarations
*/
var FontsComLoader = (function() {