Skip to content

Instantly share code, notes, and snippets.

View prohazko2's full-sized avatar

prohazko prohazko2

View GitHub Profile
alias gta='f() { git tag -m "" -a $1; git push origin $1 };f'
alias gbump='f() {gaa; gcam "bump to $1"; ggp; git tag -m "" -a $1; git push origin $1 };f'
#!/bin/bash
empty=""
image=${1//\.tar/$empty}
echo $image
docker load --input $image.tar
docker tag $image localhost:5000/$image
docker push localhost:5000/$image
const net = require('net');
const repl = require('repl').start('> ');
const sockets = repl.context.sockets = [];
const loggerFor = socket => msg => {
const idx = sockets.indexOf(socket);
const name = socket.remoteAddress;
const [time] = new Date().toISOString().replace('T', ' ').split('.');
console.log(`[${idx + 1}/${sockets.length}] ${time} ${name} - ${msg}`);
const v1 = `https://${process.env.RIC_HOST}/api/v1`;
const login = process.env.RIC_USER;
const password = process.env.RIC_PASS;
async function getToken() {
const resp = await fetch(`${v1}/auth/token`, {
method: 'post',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ login, password })
});
const mqtt = require('mqtt').connect('mqtt://sandbox.rightech.io', {
clientId: 'mqtt-prohazko-fFJlHqZwnH7wYTihXOlH0',
//key: require('fs').readFileSync('./key.pem').toString(),
//cert: require('fs').readFileSync('./crt.pem').toString(),
});
const si = require('systeminformation');
const nanoid = require('nanoid');
const { Server } = require('ws');
const ports = {};
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: monitoring
namespace: kube-system
secrets:
- name: monitoring-secret-token
---
apiVersion: v1
@prohazko2
prohazko2 / Makefile
Last active October 6, 2020 23:22
libmosquitto test
# > sudo apt install libmosquitto-dev
# > make
# > ./mqtt
mqtt: mqtt.o
$(CC) $(LDFLAGS) mqtt.o -o mqtt -lmosquitto
mqtt.o: mqtt.c
$(CC) $(CFLAGS) -c mqtt.c -lmosquitto
clean:
@prohazko2
prohazko2 / Makefile
Last active October 6, 2020 23:31
openwrt-hello-world
include $(TOPDIR)/rules.mk
# Name, version and release number
# The name and version of your package are used to define the variable to point to the build directory of your package: $(PKG_BUILD_DIR)
PKG_NAME:=helloworld
PKG_VERSION:=1.0
PKG_RELEASE:=1
# Source settings (i.e. where to find the source codes)
# This is a custom variable, used below
const cert = `
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
`;
const key = `
-----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----
`;
// from: https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/HTTPSRequest/HTTPSRequest.ino
/*
HTTP over TLS (HTTPS) example sketch
This example demonstrates how to use
WiFiClientSecure class to access HTTPS API.
We fetch and display the status of
esp8266/Arduino project continuous integration
build.