Skip to content

Instantly share code, notes, and snippets.

View tomasinouk's full-sized avatar

Tomas Blaha tomasinouk

View GitHub Profile
@tomasinouk
tomasinouk / Disable Stict host check OS X
Last active August 29, 2015 14:11
Disable strict host checking in OS X for IP subnet
# You will need to probably create ~/.ssh/config file or edit, and add the following lines:
# Host [IP Address]
# StrictHostKeyChecking no
# UserKnownHostsFile=/dev/null
# A example for whole 192.168.0.0/16 IP subnet:
Host 192.168.*.*
StrictHostKeyChecking no
@tomasinouk
tomasinouk / I2C_scanner
Created March 30, 2015 05:36
I2C scanner from Arduino playground using **wire** library
// --------------------------------------
// i2c_scanner
//
// Version 1
// This program (or code that looks like it)
// can be found in many places.
// For example on the Arduino.cc forum.
// The original author is not know.
// Version 2, Juni 2012, Using Arduino 1.0.1
// Adapted to be as simple as possible by Arduino.cc user Krodal
@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
-- 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 / 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 / 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 / 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 / extract-rename-files.py
Created June 23, 2016 06:17
recursively search for files in directories and copy them to new location with modified name
import shutil
import os
import re
source = os.walk("~/Downloads/camera/")
destination = "~/Downloads/mobotix-pic/"
# for files in source:
for root, dirs, files in source:
# print(files)
for _file in files:
@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)

Script reads BIN0 (binary input 0) on the Conel, SmartWorkx router and displaying it in a console. Can be looged in systemlog as well. Little modification can be done to log it into the file, in CSV format.

#!/bin/ash

OLD0="-1"
SLEEP_TIME=1

while true