Skip to content

Instantly share code, notes, and snippets.

@vurdalakov
vurdalakov / i2c_scanner.py
Last active August 14, 2025 06:14
A MicroPython program that scans all available I2C bus configurations on the Raspberry Pi Pico (RP2040 and RP2350), cycling through high, standard, and low frequencies to detect and list connected I2C devices.
# A MicroPython program that scans all available I2C bus configurations on the Raspberry Pi Pico (RP2040 and RP2350),
# cycling through high, standard, and low frequencies to detect and list connected I2C devices.
# https://gist.github.com/vurdalakov/7e2aca81c067b879b906513838cf9af9
from machine import Pin, I2C
count = 0
# RP2040 and RP2350A have 30 GPIOs; RP2350B has 48 GPIOs
for i in range(0, 48, 2):
@vurdalakov
vurdalakov / IsMsiRunning.cs
Created August 9, 2024 07:15
Check if Windows Installer is running in C#
public static Boolean IsMsiRunning()
{
try
{
return Mutex.TryOpenExisting(@"Global\_MSIExecute", out _);
}
catch
{
return false;
}
@vurdalakov
vurdalakov / StringArrayConverter.cs
Created July 31, 2024 06:27
String array converter for YamlDotNet
namespace Vurdalakov.YamlDotNetStringArrayConverter
{
using System;
using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;
internal class Program
@vurdalakov
vurdalakov / Nucleo_F767_blink.cpp
Last active June 25, 2024 08:27
Blinks all 3 user LEDs on STM32 NUCLEO-F767ZI board using libopencm3
@vurdalakov
vurdalakov / tailscale-install.sh
Created February 12, 2024 09:07
Install Tailscale to the Raspberry Pi
#!/bin/sh
# Installing Tailscale to the Raspberry Pi
# https://pimylifeup.com/raspberry-pi-tailscale/
# update the package list and any out-of-date packages
sudo apt-get update && sudo apt-get -y upgrade
# install needed packages
sudo apt install lsb-release curl
@vurdalakov
vurdalakov / SeeedStudioWioTerminal.md
Created March 11, 2023 17:10
Seeed Studio Wio Terminal

Problem

.pio\libdeps\seeed_wio_terminal\Seeed Arduino rpcWiFi\src\WebServer.cpp:31:10: fatal error: Seeed_mbedtls.h: No such file or directory

Solution

  • Install Seeed_Arduino_mbedtls library (or search for "seeed mbedtls" in Library Manager)
  • Add #include line above #include
@vurdalakov
vurdalakov / GitCheatsheet.md
Last active November 20, 2023 04:18
Git cheatsheet

Remove last commit from local Git repository

git reset HEAD^

Remove last commit from remote Git repository

# remove commit locally
@vurdalakov
vurdalakov / CountsPerMinute.h
Created May 30, 2022 05:55
How to get CPM value from the RadSens Geiger counter board with RadSensBoard library
#ifndef __COUNTS_PER_MINUTE_H__
#define __COUNTS_PER_MINUTE_H__
class CountsPerMinute
{
int m_currentCpm;
int m_maximumCpm;
int m_intervalsPerMinute;
int* m_intervalCounts;
int m_currentInterval;
@vurdalakov
vurdalakov / GetTimeFormatEx.cs
Last active April 13, 2021 06:33
Format the current local system time using the preferences set in the regional and language options portion of Control Panel
namespace Vurdalakov
{
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
public static class DateTimeApi
{
public static String GetCurrentTimeString(Boolean shortTime)
@vurdalakov
vurdalakov / QueryDosDevice.cs
Created March 31, 2021 07:09
Get list of MS-DOS devices and their mappings using QueryDosDevice function
namespace Vurdalakov
{
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
class Program
{
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]