Skip to content

Instantly share code, notes, and snippets.

{
"type":"message",
"attachments":[
{
"contentType":"application/vnd.microsoft.card.adaptive",
"contentUrl":null,
"content":{
"type": "AdaptiveCard",
"body": [
@robshep
robshep / index.html
Created June 21, 2022 21:49
Load data from API and display on web page
<!DOCTYPE html>
<html style="padding: 0; margin: 0;">
<head>
<meta charset="UTF-8" />
<style>
body, html {
margin:0;
padding:0;
}
{
"swagger": "2.0",
"basePath": "",
"info": {
"title": "ChirpStack Application Server REST API",
"version": "1.0.0",
"description": "\nFor more information about the usage of the ChirpStack Application Server (REST) API, see\n[https://www.chirpstack.io/application-server/api/](https://www.chirpstack.io/application-server/api/).\n"
},
"schemes": null,
"consumes": [
@robshep
robshep / README.md
Last active July 16, 2021 15:25
Changing Frame's Height By Child-to-parent browser messaging

Using Child-to-parent browser messaging to signal a frame's height based on rendered content

message listener which listens for messages from child objects to (this) parent.

handles string-encoded JSON messages with {widgetId: id, height: x} and handles changing child object height from its declared height -

@robshep
robshep / script.js
Created November 3, 2020 10:12
fiddle with CSS dynamically on static sites using URL params
(function(){
/*! js-ready - v0.0.1
* https://github.com/zombiept2/js-ready
* Copyright (c) 2014; Licensed MIT */
var ready=(function(){var f,b,c={};c["[object Boolean]"]="boolean";c["[object Number]"]="number";c["[object String]"]="string";c["[object Function]"]="function";c["[object Array]"]="array";c["[object Date]"]="date";c["[object RegExp]"]="regexp";c["[object Object]"]="object";var d={isReady:false,readyWait:1,holdReady:function(g){if(g){d.readyWait++}else{d.ready(true)}},ready:function(g){if((g===true&&!--d.readyWait)||(g!==true&&!d.isReady)){if(!document.body){return setTimeout(d.ready,1)}d.isReady=true;if(g!==true&&--d.readyWait>0){return}f.resolveWith(document,[d])}},bindReady:function(){if(f){return}f=d._Deferred();if(document.readyState==="complete"){return setTimeout(d.ready,1)}if(document.addEventListener){document.addEventListener("DOMContentLoaded",b,false);window.addEventListener("load",d.ready,false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",b);window.
@robshep
robshep / hostwatch
Last active June 9, 2020 13:48
Dump disk and mem to syslog
*/10 * * * * admin (echo "========= Disk ==========="; df -h; echo "========== Mem ==========="; free -h) | logger -t SYS
@robshep
robshep / Byebye.c
Last active May 1, 2020 11:21
Rest on Panic
#include <linux/module.h>
#include <linux/kernel.h>
static int __init seeya(void) {
char msg[0] = {};
panic(msg);
return 0;
}
module_init(seeya);
@robshep
robshep / KairosDBEmbeddedContextInit.java
Last active April 20, 2020 09:24
Pooling HTTP Connection for KairosDB
package com.example;
import java.util.HashMap;
import java.util.Map;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ApplicationListener;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.event.ContextClosedEvent;
import org.springframework.core.env.MapPropertySource;
@robshep
robshep / README.md
Last active April 17, 2020 10:47
Linux Shell Power Snippets

Snippets for the shell (mostly bash)

Fetch a URL when you don't have wget or curl (e.g in an alpine docker container)

# drop in a function
fetch() { (echo -ne "GET $2 HTTP/1.0\r\nHost: $1\n\r\n"; sleep 5) | \
           openssl s_client -connect $1:443 -quiet -msgfile /dev/null | \
           perl -pe 'BEGIN { while (<>) { last if $_ eq "\r\n"; } }';
}
@robshep
robshep / .screenrc
Created April 15, 2020 17:48
screen RC
startup_message off
term screen-256color
bind ',' prev
bind '.' next
screen -t t2 /bin/false
screen -t t1 bash
select 0
kill