Skip to content

Instantly share code, notes, and snippets.

@muka
muka / example.md
Last active November 19, 2017 05:35

Notice: as per node-red contrib guideline, the module has been renamed node-red-contrib-openfaas

Setup

  • Start OpenFaaS
  • Install node-red-admin sudo npm i -g node-red-admin
  • Start node-red docker run -it --rm -p 1880:1880 -v `pwd`:/shared --network host --name mynodered nodered/node-red-docker
  • Install openfaas module node-red-admin install node-red-contrib-openfaas
  • Done go to http://127.0.0.1:1880
var items = []
var read = ()=> {
var clr = (s) => s.replace("\n", "").trim()
jQuery('.media-body').each((i, el) => {
var item = jQuery(el)
var url = clr(item.find('h4 a').attr('href').trim())
var items = []
var read = ()=> {
var clr = (s) => s.replace("\n", "").trim()
jQuery('.media-body').each((i, el) => {
var item = jQuery(el)
//console.log(item)
var s = "886953285be646dee459532b743aeb3c"
var out = []
for(var i=0; i<s.length; i++){
var i1 = s[i]
i++
var i2 = s[i]
out.push(`0x${i1}${i2}`)
}
console.log("{ %s }", out.join(", "))
@muka
muka / Utils.java
Last active April 12, 2017 06:29
Load a properties file from resources package
/*
* Copyright 2017 FBK/CREATE-NET
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
curl test1:test1@localhost:8090/auth/oauth/token -d grant_type=client_credentials
@muka
muka / dhcpd.conf
Last active November 21, 2019 07:25
Setup a dhcpd server using docker
ddns-update-style none;
option domain-name "thpi";
option domain-name-servers 208.67.222.222, 208.67.220.220;
default-lease-time 86400;
max-lease-time 604800;
authoritative;
@muka
muka / renew.md
Last active January 25, 2017 11:11
letsencript renew
var mqtt = require('mqtt');
var client = mqtt.connect('mqtt://localhost:1883', {
username: "admin",
password: "eyJhbGciOiJIUzUxMiJ9.eyJjcmVhdGVkIjoxNDc3NDg1NDc5OTEzLCJleHAiOjE0Nzc0ODcyNzksInV1aWQiOiI2NmVkNDc3Mi0wNDg5LTRlOTYtYmI2NS01NDhiMmVkMmM3MWQifQ.LbOAr8pPApDlVBLi32JWtCjmCa80ByAJYq9BnTnWQgh4SWka4WzykMU0D_atE5tYtgICj2QOg-OFglv2ZqLLNw",
protocolId: 'MQTT',
protocolVersion: 4,
});
client.on('connect', function () {