Skip to content

Instantly share code, notes, and snippets.

#include <OneWire.h>
#include <EtherCard.h>
#include <avr/wdt.h>
// milliseconds to wait for data send
#define REQUEST_RATE 60000
// ethernet module RST pin
#define ETHERNET_RST 6
<?php
// some settings first
$rrdtool = "/usr/bin/rrdtool";
$rrd = "temps.rrd";
$png = "temps.png";
$pngUptime = "temps.uptime.png";
$last = "temps.last.txt";
// parse data from request
NOVA(CESKE RADIOKOMUNIKACE):690000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_NONE:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:101:111:513
NOVA CINEMA(CESKE RADIOKOMUNIKACE):690000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_NONE:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:401:411:514
Prima COOL(CESKE RADIOKOMUNIKACE):690000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_NONE:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:501:511:770
Prima(CESKE RADIOKOMUNIKACE):690000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_NONE:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:601:611:773
BARRANDOV TV(CESKE RADIOKOMUNIKACE):690000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_NONE:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:301:311:2050
CT 1(Ceska televize):698000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_NONE:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:257:273:257
CT 2(Ceska televize):698000000:INVERSION_AUTO:BA
<div id="seznam-programu"></div>
<script>
var url = "https://fixnet.cz/programy-source-data";
var el = document.getElementById("seznam-programu");
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){
if (xhr.readyState == 4 && xhr.status == 200){
el.innerHTML = xhr.responseText;
}

Simple asymmetric backup encryption

Requirements is OpenSSL and Bash. It generates password for AES encryption, encrypt file and then it encrypt password with your public key. Tested on Ubuntu 16.04...

Encrypting

  1. generate public key from your private key:
#!/usr/bin/env bash
set -e
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
PROGNAME=`basename $0`
OID_GENERAL_ALARM="1.3.6.1.4.1.9839.2.1.1.23"
OID_ALARMS=(
"1.3.6.1.4.1.9839.2.1.1.5:High Pressure Alarm"
"1.3.6.1.4.1.9839.2.1.1.6:Low Pressure Alarm"
@analogic
analogic / expecting.md
Created May 24, 2017 11:21 — forked from ksafranski/expecting.md
Basic principles of using tcl-expect scripts

Intro

TCL-Expect scripts are an amazingly easy way to script out laborious tasks in the shell when you need to be interactive with the console. Think of them as a "macro" or way to programmaticly step through a process you would run by hand. They are similar to shell scripts but utilize the .tcl extension and a different #! call.

Setup Your Script

The first step, similar to writing a bash script, is to tell the script what it's executing under. For expect we use the following:

#!/usr/bin/expect
#!/usr/bin/expect
;#
;# quick "Expect" language manual at https://gist.github.com/analogic/95d2972b61b81ada177f620f847f6b51
;#
lassign $argv userhost password interface port json
if {$port eq ""} {
puts "Help: ./dslam.expect <user@host> <password> <interface> <port> \[json\]"
puts " "
package main
import (
"fmt"
"runtime"
"time"
"bytes"
"strings"
"github.com/kidoman/embd"
.| IPV4_SRC_ADDR | IPV4_DST_ADDR | IPV4_NEXT_HOP | IN_PKTS | IN_BYTES | FIRST_SWITCHED | LAST_SWITCHED | BGP_IPV4_NEXT_HOP | INPUT_SNMP | OUTPUT_SNMP | L4_SRC_PORT | L4_DST_PORT | SRC_AS | DST_AS | SRC_VLAN | DST_VLAN | UNKNOWN_TYPE_232 | TCP_FLAGS | PROTOCOL | SRC_TOS | SRC_MASK | DST_MASK | DIRECTION | FORWARDING_STATUS | UNKNOWN_TYPE_326 |
| 178.248.58.59 | 205.185.216.10 | 85.207.213.133 | 1 | 60 | 202h52m19s | 202h52m19s | 0.0.0.0 | 49 | 22 | 49653 | 443 | 0 | 0 | 0 | 17652 | n/a | R | 0x06 | 0x00 | 24 | 0 | Egress | 0x00 | n/a |
| 178.248.56.193 | 0.80.13.149 | 85.207.213.133 | 1 | 1464 | 202h52m24s | 202h52m24s | 0.0.0.0 | 22 | 22 | 0 | 0 | 0 | 0 | 0 | 501 | n/a | | 0x3d | 0x4a | 24 | 0 | Ingress | 0x00 |