Skip to content

Instantly share code, notes, and snippets.

View stachjankowski's full-sized avatar

Stanisław Jankowski stachjankowski

View GitHub Profile
@capotej
capotej / CachedMkdir.scala
Created March 4, 2012 23:48
Cached mkdir -p in scala
// Usage:
// val dircache = new CachedMkdir
// dircache.mkdirp("a/b/c/d/e") // creates the directory structure
// dircache.mkdirp("a/b/c/d/e") // does nothing
// dircache.mkdirp("a/b/Z/Y/Z") // only creates from b/ down
class CachedMkdir {
var cache = Set[String]()
@mkrasowski
mkrasowski / setup_tunnel.sh
Last active December 22, 2019 18:11
Persistent reverse SSH tunnel. Connect to internal network from outside.
#!/bin/bash
listenport_on_remote=5500
identity_key=/home/me/.ssh/tunnel
#############################
REMOTE=$1
if [ ! "$REMOTE" ]; then
@carcinocron
carcinocron / debugger pause beforeunload
Last active July 10, 2024 08:48
Chrome: pause before redirect
// Run this in the F12 javascript console in chrome
// if a redirect happens, the page will pause
// this helps because chrome's network tab's
// "preserve log" seems to technically preserve the log
// but you can't actually LOOK at it...
// also the "replay xhr" feature does not work after reload
// even if you "preserve log".
window.addEventListener("beforeunload", function() { debugger; }, false)
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@atmb4u
atmb4u / timeit.scala
Created December 29, 2016 20:24
timeit for scala
// http://stackoverflow.com/questions/9160001/how-to-profile-methods-in-scala
def time[R](block: => R): R = {
val t0 = System.nanoTime()
val result = block // call-by-name
val t1 = System.nanoTime()
println("Elapsed time: " + (t1 - t0) + "ns")
result
}
@max-mapper
max-mapper / links.json
Last active November 11, 2023 03:11
all wikipedia zim torrent links
@alisonamerico
alisonamerico / gist:d858bd52caf996d7ba590513e7972be9
Created July 26, 2020 00:50
erro_ao_instalar_lib_gdal_via_poetry
snowman on  84 [!?] is 📦 v0.1.0 via 🐍 v3.8.3 (.venv)
❯ poetry add gdal
Using version ^3.1.2 for gdal
Updating dependencies
Resolving dependencies...
Writing lock file
@alexklibisz
alexklibisz / 0-firefly-grafana-example.md
Last active May 12, 2024 22:53
Firefly + Grafana Example
@bnapalm
bnapalm / danfoss_trv_ext_temp_z2m.yaml
Created September 25, 2022 15:41
Danfoss Ally TRV send external temperature (zigbee2mqtt)
blueprint:
domain: automation
name: Danfoss Ally Ext Temp Z2M
description: Update Danfoss Ally TRV external temperature with min/max refresh rate, via zigbee2mqtt
input:
ally_device:
name: Ally TRV Device
description: Temperature reading will be sent to this device
selector:
device:
@bnapalm
bnapalm / ally_trv_load_balancing_z2m.yaml
Last active November 20, 2022 14:55
Danfoss Ally TRV room load balancing for Zigbee2MQTT
blueprint:
domain: automation
name: Danfoss Ally Room Load Balancing
description: >
Calculate and send room mean load every 15min to
load balance TRVs in the same room, via zigbee2mqtt.
Uses Danfoss recommended calculation.
input:
ally_devices:
name: Danfoss Ally TRV Device