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 / 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())
@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 / AdobeSdkString.h
Last active March 22, 2019 07:01
[C++] Helper class for working with ADOBESDK_String
#pragma once
#include <string>
class AdobeSdkString
{
ADOBESDK_StringSuite1* _stringSuite;
ADOBESDK_String _string;
BOOL _dispose;
@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