Skip to content

Instantly share code, notes, and snippets.

dj0001 / dwdhue.bat
Last active Dec 14, 2018
weather warnings from DWD on philipshue
View dwdhue.bat
Rem DWD-Warnmodul (win10 1803), parameter addresse
@echo off
set lat=48.37& set lon=10.90
set /p lat="Enter lat(%lat%) " & set /p lon="Enter lon(%lon%) "
set bridge=http://localhost:8000/api/newdeveloper
if "%1"=="" (set /p bridge="change bridge adress(%bridge%) ") else (set bridge=%1)
set light=1
set /p light="select light(%light%) "
duhaime /
Last active Jun 3, 2021
Compare image similarity in Python using Structural Similarity, Pixel Comparisons, Wasserstein Distance (Earth Mover's Distance), and SIFT
import warnings
from skimage.measure import compare_ssim
from skimage.transform import resize
from scipy.stats import wasserstein_distance
from scipy.misc import imsave
from scipy.ndimage import imread
import numpy as np
import cv2
cuixin / json_to_map.go
Created Oct 25, 2017
json to map[string]interface{} example in golang
View json_to_map.go
package main
import (
func dumpMap(space string, m map[string]interface{}) {
for k, v := range m {
if mv, ok := v.(map[string]interface{}); ok {
stefanmaric /
Created Sep 7, 2016
Create Bookmarklet (browser bookmark that executes Javsacript) to copy a given text to Clipboard

Copy-to-clipboard Bookmarklet

Create Bookmarklet (browser bookmark that executes Javsacript) to copy a given text to Clipboard.

This is the base javascript:

(function (text) {
  var node = document.createElement('textarea')
  var selection = document.getSelection()
bastman /
Created Mar 31, 2016
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see:

$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
turtlemonvh / Caddyfile
Last active Mar 29, 2021
Multi-host wildcard caddy example
View Caddyfile {
tls off
root /var/www/
proxy / localhost:8091
log log/access.a.log
} {
tls off
root /var/www/
trieloff /
Created Oct 24, 2015
A command line alternative to LampStealer

The LampStealer app for Hue does not work with newer versions of the bridge, as the API has changed. This shell script works with fewer dependencies and achieves the same. Install jq and run the shell script after pushing the big button on the bridge.

rozifus / Python SimpleHTTPServer with SSL
Last active Jun 13, 2021
Python SimpleHTTPServer with SSL
View Python SimpleHTTPServer with SSL
# useful for running ssl server on localhost
# which in turn is useful for working with WebSocket Secure (wss)
# copied from
aras-p / preprocessor_fun.h
Last active Jun 25, 2021
Things to commit just before leaving your job
View preprocessor_fun.h
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
inflammable / base58.js
Created Jun 14, 2012
Base58 (and other) Encoding and Decoding in Javascript
View base58.js
* base58.js
* - encodes integers to and decodes from a base58 (or your own) base58 alphabet
* - based on Flickr's url shortening
* usage:
* base58.encode(integer);
* base58.decode(string);
* (c) 2012 inflammable/raromachine