Skip to content

Instantly share code, notes, and snippets.

@sovcik
sovcik / arduino_pulse_counter.cpp
Created November 4, 2020 13:45
Arduino ATmega328 as Asynchronous Pulse Counter
// ARDUINO as ASYNCHRONOUS PULSE COUNTER
//
// Pulses are counted asynchronously using Timer1 circuit as counter. Interrupt is
// triggered once counter reaches the set level.
//
// Pulse source should be connected to pin D5 (alternative function T1 - Timer1)
// Make sure to install pull-down resitor on pulse input pin to avoid ghost inputs.
// Also make sure to debounce pulse source, e.g. in case of using mechanical button
//
// For more information see ATmega328P DataSheet section 15. 16-bit Timer1/Counter with PWM
@sovcik
sovcik / BackupWin.ps1
Last active October 5, 2019 10:46
Script for automated delta backup to Amazon AWS S3 for Windows computers
<#
This is a simple script does delta backup of specified folders and uploads
them to Amazon S3 bucket.
Prerequisites
=============
1) installed 7zip archiver (https://www.7-zip.org/)
Installation
============
@sovcik
sovcik / parse_st.bat
Created June 11, 2018 18:02
Parse ESP stack trace
@echo off
rem set following to point to addr2line executable
set addr2linecmd=xtensa-lx106-elf-addr2line.exe
rem set following to point to executable you would like to debug
rem executable has to be compiled with -ggdb option in order to include debug info
set exename=c:\.......\.pioenvs\nodemcu\firmware.elf
rem set following to point to filecontaining stacktrace - only addresses
set stacktracefile=stack.txt
for /F "tokens=2,3,4,5" %%i in (%stacktracefile%) do (
@sovcik
sovcik / rgb_led_panel_32x16.ino
Last active August 10, 2016 15:46
Simple Arduino sketch showing how to control RGB LED panel 32x16, scan 1/8.
/*
* Simple sketch controlling RGB LED panel 32x16 scan rate 1/8
* Panel needs to be continuosly redrawn in order to power LEDs.
*
* Pins:
* R1,R2 - red led for upper & lower half
* G1,G2 - green led for upper & lower half
* B1,B2 - blue led for upper & lower half
*
* A,B,C - row selector = 2^3 = 8 rows (upper & lower halves x 8 = 16 rows)
@sovcik
sovcik / create_snapshot.ps1
Last active October 14, 2015 19:57
Powershell script creating snapshots from folders using 7zip archiver.
param (
# if parameter "-i" Input Path was not specified, folder from which script has been invoked will be used
[string]$i = "#",
# if parameter "-f" Include File was not specified, all files/folders will be processed
[string]$f = "#",
# parameter "-o" Output Folder is required
[string]$o = "#",
# parameter "-a" specifying archiver command
[string]$a = 'c:\Program Files\7-zip\7z.exe'
)
@sovcik
sovcik / page.vmd
Created January 19, 2011 19:12
Confluence page layout containing additional sidebar showing pagetree (velocity script)
## PAGE SPECIFIC DECORATOR
## Here the context is the page. Modes are 'view', 'edit', 'edit-preview', 'view-information', and 'view-attachments'.
#set ($helper = $params.get("helper"))
#set ($mode = $params.get("mode"))
#set ($context = $params.get("context"))
#set ($confPage = $helper.page)
#infoPanelInitFromParams()
## GENERAL PAGE DECORATING BEGINS
@sovcik
sovcik / create_installer_account.sh
Created December 8, 2010 21:33
Script to be passed to Amazon AWS AMI as "user-data". This script creates "installer" account using which you can connect to your instance and perform its customization without necessity to share instance key-pair private key.
#!/bin/bash
###############################################
#
# Script creates system user account, configures it for SSH access
# and gives it "root" access via SUDO.
# Intention is to pass it as "user-data" to Amazon AWS instance, which will
# execute it during its start-up.
#
# Copyright (c) 2010 by Jozef Sovcik, http://www.vanilladesk.com
# Feel free to modify it as necessary.
@sovcik
sovcik / iam-switch.sh
Created November 22, 2010 10:47
Script for account/identity switching while using Amazon AWS Cloud tools
#!/bin/bash
###############################################
#
# Script for switching identities while working with Amazon AWS.
# Sets environment variables used by AWS tools.
#
# Copyright (c) 2010 by Jozef Sovcik, http://www.vanilladesk.com
#
#---------------------------------------------
# How to use: