Skip to content

Instantly share code, notes, and snippets.

@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)]
@vurdalakov
vurdalakov / CurrentUser.cs
Created October 28, 2020 11:12
C#: Does current user have local admin rights
namespace Vurdalakov
{
using System;
using System.Security.Principal;
public static class CurrentUser
{
public static Boolean IsAdministrator()
{
using (var windowsIdentity = WindowsIdentity.GetCurrent())