Skip to content

Instantly share code, notes, and snippets.

Avatar

Juho Mäkinen garo

View GitHub Profile
View streamsave.js
// This program receives BLE advertisements from www.streamsave.fi shower consumption devices and displays the data inside.
// Installation: see https://www.npmjs.com/package/@abandonware/noble
const noble = require('@abandonware/noble');
noble.on('stateChange', async (state) => {
if (state === 'poweredOn') {
noble.startScanning([], true);
}
});
View send zfs snapshot ages to zabbix
#!/usr/bin/ruby
require 'json'
str = `zfs list -t snapshot -o name,creation -H -p`.split("\n")
zabbix_server = "..."
hostname = `hostname`
filesystems = {}
View gist:b53a4b19d8ad4b6d6fbb8b408198e0b1
47 47 00 df 00 00 64 02 21 00 7c 02 dc b5 c4 7c 01 00 30 f0 e4 a7 01 18 puhetta
47 47 00 e0 00 00 64 02 21 00 7c 02 dc b5 c4 7c 01 00 40 f0 a3 a7 d2 e7
47 47 00 e1 00 00 64 02 21 00 7c 02 dc b5 c4 7c 01 00 0e f0 ac a7 bd e7
47 47 00 e2 00 00 64 02 21 00 7c 02 dc b5 39 7d 01 00 6d 80 d6 57 91 eb
47 47 00 e3 00 00 64 02 21 00 7c 02 dc b5 01 7d 01 00 cd 7f e3 d7 9b eb
47 47 01 01 00 00 64 02 21 00 7c 02 dc b5 d2 b9 00 00 06 1d a5 67 11 a4 tässä tulee joku muu tyyppi, huomaa neljäs tavu on 01
47 47 00 e4 00 00 64 02 21 00 7c 02 dc b5 ed 7d 01 00 c2 2f 21 58 1f 0b taas puhetta
47 47 00 e5 00 00 64 02 21 00 7c 02 dc b5 05 7d 01 00 95 7f 4f 68 2a 14
47 47 00 e6 00 00 64 02 21 00 7c 02 dc b5 01 7d 01 00 d7 7f 0c 28 61 14
47 47 00 e7 00 00 64 02 21 00 7c 02 dc b5 c8 7c 01 00 c5 0f 13 98 1e 18
View gist:c10bf40ec3f8bc306fe33d81ad9ebde3
<Buffer 47 47 00 19 00 00 af 11 21 00 7c 02 dc b5 b9 5c 00 00 c2 1d db 57 9f e3 dd 2a ce c4 43 af 50 fc bf ba e5 d5 96 1c 00 03 85 ba af 52 02 1f 5a 11 0e bf e2 ...>
<Buffer 47 47 00 e0 00 00 af 11 21 01 7c 02 dc b5 84 57 00 00 8a 42 1b 77 a4 aa f4 d7 10 7b 84 11 ef 15 7c ba ca d7 4f 55 9a ea 2d 45 af 43 b0 55 62 ee b7 45 b7 ...>
<Buffer 47 47 00 fa 00 00 b0 11 21 00 7c 02 dc b5 f6 2b 00 00 e5 46 9b 5b bb 98 a6 e3 c9 8d c0 48 ea 8c 74 dc a0 e3 4d 67 e0 8c 89 23 d5 e2 37 3a 10 37 c5 dc 62 ...>
<Buffer 47 47 00 8a 00 00 b0 11 21 01 7c 02 dc b5 fc 26 00 00 b0 10 98 f2 37 a6 eb f5 c0 21 0b e5 81 54 f5 1e a8 f5 43 a6 a6 54 e5 1e cb af eb 30 cc 87 50 95 12 ...>
<Buffer 47 47 00 1a 00 00 af 11 21 00 7c 02 dc b5 f9 5c 00 00 d3 1d 5a 88 31 18 77 2a 41 c4 8f ef ba fc 69 45 5c 2a a0 e7 b1 fc 52 45 66 ac c0 c0 8e ee c7 40 de ...>
<Buffer 47 47 00 e1 00 00 af 11 21 01 7c 02 dc b5 c4 57 00 00 96 cd db f8 7b a0 1d d9 40 9b ba f1 f1 14 4d bb 25 26 86 5f d7 ea af 45 7f 31 24 f9 07 91 1e c5 a0 ...>
<Buffer 47 47 00 fb 00 00 b0
View bmp280-sensor-in-nodemcu.ino
/*
ESP8266 Blink by Simon Peter
Blink the blue LED on the ESP-01 module
This example code is in the public domain
The blue LED on the ESP-01 module is connected to GPIO1
(which is also the TXD pin; so we cannot use Serial.print() at the same time)
Note that this sketch uses LED_BUILTIN to find the pin with the internal LED
*/
View mymodule main.tf
module "test" {
source "./mymodule"
# This seems to work
security_groups_as_a_list = ["12341234"]
# But this produces an error: aws_instance.vm: security_groups: should be a list
security_groups_as_a_list = ["${aws_security_group.terminal.id}"]
# This would also work, but it's ugly
a_single_security_group = "${aws_security_group.terminal.id}"
View gist:12b83a7d8c6bc078ac4be5599ef548a4
variable "foo" {
default = ["1", "2", "3"]
}
variable "bar" {
default = ["a", "b"]
}
resource "aws_sns_topic" "test" {
name = "${element(var.foo, count.index / length(var.bar))}-${element(var.bar, count.index)}"
View gist:e216a9a9a8ee8b0271e2d946fa46f9a8
variable "foo" {
default = ["1", "2", "3"]
}
variable "bar" {
default = ["a", "b", "c"]
}
resource "aws_sns_topic" "test" {
name = "${element(var.foo, count.index)}-${element(var.bar, count.index)}"
View gist:974113c6d1f056973efdb8357ceb7e96
variable "topics" {
default = ["new_users", "deleted_users"]
}
variable "environments" {
default = ["prod", "staging", "testing", "development]
}
for $topic in topics {
# Define SNS topics which are shared between all environments
View palringo-eilium-tampermonkey.js
// ==UserScript==
// @name Palringo hax for assembly by Garo
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Tampermonkey script which modifies Palringo feedback page so that it's suitable for easy copy-pasting into Eilium. Used in Assembly Summer 2016
// @author Garo
// @match http://www.palringo.com/en/gb/feedback
// @grant none
// ==/UserScript==
(function() {