Skip to content

Instantly share code, notes, and snippets.

Avatar

Tomas Blaha tomasinouk

View GitHub Profile
View make_serial_passthrough_circuitpython.md

I have done this on Challenger LTE board link, which is RP2040 based.

You need to enable data serial at boot (boot.py), this is disabled by default. When the board boots you need to run file serial_passthrough.py the program.

Your computer will report new COM/Serial port. Use that to talk with the device connected to uart of the CircuitPython board.

Create files on CIRCUITPY

file: boot.py

@tomasinouk
tomasinouk / test_coms_with_SARA_R4.py
Created Jan 8, 2022
Testing communication with SARA R410M on iLab Challenger Board
View test_coms_with_SARA_R4.py
import board
import busio
import digitalio
import time
uart = busio.UART(board.SARA_TX,board.SARA_RX,rts=board.SARA_RTS, cts=board.SARA_CTS, baudrate=115200,timeout=5)
@tomasinouk
tomasinouk / tabbed-description.liquid
Created Jun 26, 2019 — forked from tairli/tabbed-description.liquid
Tabbed Product description snippet for Shopify
View tabbed-description.liquid
{% comment %}
if combine_pretext is false, the text before the first <h6> will be shown above all tabs, otherwise added to the first tab
{% endcomment %}
{% assign combine_pretext = false %}
{% assign description = tabbed-description | default: product.description %}
{% if description contains "<h6>" %}
{% assign tab_heads = '' %}
{% assign tab_texts = '' %}
{% assign pretext = '' %}
@tomasinouk
tomasinouk / reset_poe_smartflex.sh
Created Mar 28, 2018
Reset PoE if ping fails on SmartFlex - PoE unit
View reset_poe_smartflex.sh
# created by Tomas Blaha - Dureco
# script check camera IP via ping every 30s
# if cannot ping it turn Off/On PoE for this camera only
# it does not cycle PoE on second PoE port
CAMERA_PING=192.168.1.22
while true
do
ping -c 1 $CAMERA_PING
@tomasinouk
tomasinouk / CORS_on_OpenWRT_UCI.md
Last active Jul 20, 2022
CORS on OpenWRT UCI
View CORS_on_OpenWRT_UCI.md

To implement Cross-Origin Resource Sharing (CORS) on OpenWRT within Luci is actually simple.

After very long search, I have found code in uHTTPd on gitlab, which clearly shows option for CORS. I haven't found anything, which would describe how to actually configure it.

There is nothing in uHTTPd documentation describing this functionally, /etc/config/uhttpd does not mention anything either.

Luckily, you can have a look into how the process is starting and what parameters is checking.

doing

@tomasinouk
tomasinouk / SmartWorkx,Conel_check_connection_2_IP.md
Created Oct 27, 2016
Script for SmartWorkx, Conel routers to check connection against 2 IP addresses. Good solution, to engage failover after both servers are not reachable.
View SmartWorkx,Conel_check_connection_2_IP.md

Here is the start-up script, which in effect does check of 2 IP addresses

#!/bin/sh
#
# This script will be executed when PPP/WAN connection is established.
#
# Script for checking connection by two ping ip addresses
#
# Put checking ip addresses
View log input status in Conel,SmartWorkx routers.md

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
@tomasinouk
tomasinouk / extract-rename-files.py
Created Jun 23, 2016
recursively search for files in directories and copy them to new location with modified name
View extract-rename-files.py
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 / cybertec-snmp-get.py
Created May 4, 2016
Retrieve Tx, Rx metrics from cellular interface on Cybertec routers via SNMP and print out data.
View cybertec-snmp-get.py
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: