Skip to content

Instantly share code, notes, and snippets.

View tomasinouk's full-sized avatar

Tomas Blaha tomasinouk

View GitHub Profile
@tomasinouk
tomasinouk / cybertec-snmp-get.py
Created May 4, 2016 01:06
Retrieve Tx, Rx metrics from cellular interface on Cybertec routers via SNMP and print out data.
from pysnmp.hlapi import *
import time
import datetime
# seconds between polls
interval = 60
# IP address of the Cybertec router
ip_address = '10.10.10.10'
# while True:
@tomasinouk
tomasinouk / RDC-BlueSolar-charger.md
Created January 31, 2016 22:02
Reconfigure BlueSolar solar charger to work with RDC

Modify setting of the Blue Solar regulator from Victron for smooth operation with RDC, if not already done by Madison Technologies.

Blue Solar - RDC charger

Detail instructions

How to connect to the regulator are here: https://www.victronenergy.com/live/ve.direct:mpptprefs

##Short version:

  1. Download the MMPTPREFS program here
@tomasinouk
tomasinouk / conel,smartworkx-sms-email-alarm.md
Last active October 27, 2016 22:28
Conel, Smartworkx start-up script - alarm sms and email based on Input status

Installation

  1. Copy&paste into Start-up Script in the Conel router menu.
  2. Fill in your email and mobile number.
  3. Apply.
  4. Reboot the router.

Modification

Please refer to offical Conel documentation Commands&Scripts_v2_v3_EN

@tomasinouk
tomasinouk / conel-enable-disable-wireless.md
Last active November 3, 2017 14:45
How to enable and disable wireless (cellular, wifi) on Conel, SmartWorkx routers. This is more for v2 routers as v3 does have more options, such as entering power saving mode.

Solution to disable and enable radio interfaces on Conel, SmartWorkx routers based on time.

Solution is to change the setting of the router enable/disable and reboot the router for the setting to be used by router.

I used two time constants:

  • On timer - TIME_ON
  • Off timer - TIME_OFF

Script to copy paste into Configuration -> Start-up Script setting of the Conel router.

@tomasinouk
tomasinouk / ffmpeg_examples.md
Created November 30, 2015 04:21
ffmpeg examples for streaming full screen

ffmpeg -f avfoundation -i "1" -vcodec libx264 -r 10 -tune zerolatency -b:v 500k -bufsize 300k -f rtp rtp://localhost:1234

ffmpeg -f avfoundation -i "1" -vcodec libx264 -r 10 -tune zerolatency -b:v 500k -bufsize 300k -f rtp udp://127.0.0.1:1234

ffmpeg -f avfoundation -i "1" -vcodec libx264 -r 10 -tune zerolatency -b:v 500k -bufsize 300k -f mpegts udp://127.0.0.1:1234

ffmpeg -f avfoundation -i "1" -vcodec libx264 -r 10 -pix_fmt uyvy422 -tune zerolatency -b:v 500k -bufsize 300k -f mpegts udp://192.168.88.38:1234

@tomasinouk
tomasinouk / Westermo-SNMP-SHDSL.md
Last active November 18, 2015 01:44
Westermo SNMP SHDSL

Speed of SHDSL(1):

IF-MIB::ifSpeed.4096 = Gauge32: 15288000

  • OID: snmptranslate -On IF-MIB::ifSpeed.4096 -> .1.3.6.1.2.1.2.2.1.5.4096

SHDSL IN:

IF-MIB::ifInOctets.4096 = Counter32: 10923350

  • OID snmptranslate -On IF-MIB::ifInOctets.4096 -> .1.3.6.1.2.1.2.2.1.10.4096
@tomasinouk
tomasinouk / parse_conel_smartworkx_gps.py
Last active October 27, 2016 22:29
Takes GPS and Cellular metrics from Conel, SmartWorkx router and write *.csv file. I used different method for parsing of each metrics as an exercise. Running Python from USB stick and writing file to a USB stick.
# run that in start-up script
# echo "Time UTC (GPS);Latitude;Longtitude;Altitude;Satellites;Fix;Speed over ground;Course over Ground;Date (GPS);Date (router);Time (Router)" > location_report.csv
import csv
import time
import datetime
import os.path
import os
csv_header_text = "Time UTC (GPS);Latitude;Longtitude;Altitude;Satellites;Fix;Speed over ground;Course over Ground;Date (GPS);Date (router);Time (Router); Cell Technology;Cell ID;Signal Strength;Signal Quality\n"
@tomasinouk
tomasinouk / battery_capacity_nodemcu
Last active August 3, 2016 17:36
Reading battery capacity nodeMCU - lua
id=0
-- represent actually PIN on nodeMCU such as
-- D7 and D5 in this case
-- GND needs to be connected
sda=7 -- GPIO13
scl=5 -- GPIO14
-- initialize i2c, set pin1 as sda, set pin2 as scl
i2c.setup(id,sda,scl,i2c.SLOW)
-- control 2 first neopixels via RGB
--ws2812.writergb(2, string.char(100,255,0,255,0,0))
-- control 8 neopixels with same RGB color
-- ws2812.writergb(2, string.char(100,255,0):rep(8))
-- -- control 8 neopixels with same RGB color - turn off
ws2812.writergb(2, string.char(0,0,0):rep(8))
@tomasinouk
tomasinouk / gist:1c59a99c82ed8df7c3f5
Last active August 29, 2015 14:21
logrotate and pm2 logs
# logrotate and pm2 logs
# file location
# /etc/logrotate.d/pm2
/root/.pm2/logs/*.log {
daily
rotate 15
missingok
notifempty
sharedscripts