Skip to content

Instantly share code, notes, and snippets.

@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 / strings.h
Created September 30, 2016 02:26
std::string to std::wstring conversion (and vice versa) using Windows API
#pragma once
#include <windows.h>
#include <string>
inline std::wstring multi2wide(const std::string& str, UINT codePage = CP_THREAD_ACP)
{
if (str.empty())
{
return std::wstring();
@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 / ImageSharpExtensions.cs
Last active May 20, 2023 11:18
SixLabors.ImageSharp extensions: convert Image<TPixel> to byte array and System.Drawing.Bitmap etc.
namespace Vurdalakov
{
using System;
using System.IO;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Formats.Png;
using SixLabors.ImageSharp.PixelFormats;
@vurdalakov
vurdalakov / KeyboardLayouts.cs
Created March 14, 2018 14:27
Working with keyboard layouts on Windows in C# (ActivateKeyboardLayout/GetKeyboardLayout/GetKeyboardLayoutList)
namespace Vurdalakov
{
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Runtime.InteropServices;
public class KeyboardLayout
@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 / 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 / increment.bat
Last active January 9, 2022 20:13
Automatically increment version number in Arduino IDE
@echo off
echo ----------------------------------------------- increment.bat script -----------------------------------------------
rem ========================================================================================
rem == This script automatically increments build number in "version.h" file.
rem == Instructions and more information:
rem == http://codeblog.vurdalakov.net/2017/04/autoincrement-build-number-in-arduino-ide.html
rem ========================================================================================
setlocal
@vurdalakov
vurdalakov / RemoveTableElementByKey.lua
Created March 28, 2018 06:42
[Lua] Remove (and return) a table element by its key
-- Removes (and returns) a table element by its key, moving down other elements to close space and decrementing the size of the array
function table.removeKey(table, key)
local element = table[key]
table[key] = nil
return element
end
-- Test
printf = function(s, ...) return io.write(s:format(...)) end
@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)