Skip to content

Instantly share code, notes, and snippets.

@WimObiwan
WimObiwan / brandon.c
Last active February 10, 2025 19:59
Coderdojo Arduino
#include <ChainableLED.h>
#include <Grove_LED_Bar.h>
#define NUM_LEDS 1
// Pin for LED control
ChainableLED leds(2, 3, NUM_LEDS); // Pin 2 for data, pin 3 for clock
// Button pin
int buttonPin = 4; // Button is connected to pin 4
@WimObiwan
WimObiwan / Select-GraphObject.ps1
Last active September 17, 2024 08:46
Select-GraphObject.ps1 to flatten objects returned by Microsoft Graph, Azure, ... Powershell cmdlets
#usage:
# Get-MgGroupMember -GroupId <someid> | `
# Select-GraphObject displayname, userprincipalname, mail, officelocation
#based on https://stackoverflow.com/questions/72384632/possible-to-pull-info-from-additionalproperties-dictionary-with-microsoft-graph
#with some changes to make it work
function Select-GraphObject {
[CmdletBinding(PositionalBinding = $false)]
param(
@WimObiwan
WimObiwan / WinDbg script.txt
Last active October 19, 2021 08:16
WinDbg troubleshoot deadlocks caused by WinForms STA-violations
* START EXE IN WINDBG
* Based on https://web.archive.org/web/20160223063851/http://blogs.msdn.com/b/dsui_team/archive/2012/10/31/debugging-windows-forms-application-hangs-during-systemevents.userpreferencechanged.aspx
sxe ld clrjit
g
.sympath srv*http://msdl.microsoft.com/download/symbols
.reload
.loadby sos.dll clr
function Get-AccessTokenClientCredentialsFlow {
param (
[string]$ClientId,
[string]$ClientSecret,
[string]$Audience
)
Add-Type -AssemblyName System.Web
$clientidEnc = [System.Web.HttpUtility]::UrlEncode($ClientId)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="/favicon.ico" />
<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/11.0.0/css/fabric.min.css" />
<title>Microsoft Teams Tab</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
cat /var/log/auth.log /var/log/auth.log | grep 'authentication failure;' | sed 's/.*rhost=\([^ ]*\).*/\1/' | sort | uniq -c
# Example usage:
# . C:\temp\Test-EnduranceSqlConnection.ps1
# Test-EnduranceSqlConnection '192.168.253.127\Corflow' -Interval ([timespan]::FromSeconds(1))
function Test-Key {
[CmdletBinding()]
param (
[System.ConsoleKey]$Key
)
function Match([string]$x, [string]$y) {
if ($x.Length -ne $y.Length) { return '' }
$result = ''
@(0..($x.Length - 1)) | %{
if ($x[$_] -eq $y[$_]) {
$result += '*'
} elseif ($y.Contains($x[$_])) {
$result += '?'
} else {
$result += '.'
dir -Recurse -Filter *.cs | gc | %{ if ($_ -match '^.*(http(?:s)?\://[^/]*/).*$') { $Matches[1] } } | select -Unique
@WimObiwan
WimObiwan / Remove values from Zabbix.md
Created October 24, 2019 15:17
Remove values from Zabbix

On Zabbix server, connect to MariaDB by running:

mysql

And go to the correct database, e.g.: