Skip to content

Instantly share code, notes, and snippets.

@jerome-labidurie
jerome-labidurie / HALegoTrain.ino
Last active May 5, 2024 19:21
Lego PoweredUp control from HomeAssistantt
/**
* Lego (Powered Up) train control from Home Assistant / MQTT with BellRing
*
* Licence: GPLv3
*
* needed libraries:
* legoino https://github.com/corneliusmunz/legoino
* > 1.1.0, tested with commit 4daae4f683b087b8c443a4c813934e3dfff41d69
* home-assistant-integration https://github.com/dawidchyrzynski/arduino-home-assistant
* 1.3.0
@mahdyar
mahdyar / AllowedUsername.php
Last active May 5, 2024 19:18
Prevent your users to register with your route paths like login, or reserved usernames as their usernames in Laravel. More: https://blog.mahdyar.me/2021/04/18/route-paths-and-reserved-usernames-in-laravel/
<?php
namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
use Illuminate\Support\Facades\Route;
class AllowedUsername implements Rule
{
/**
@9to5IT
9to5IT / Get-RDM.ps1
Last active May 5, 2024 19:18
PowerShell: Searching for RDM disks using PowerCLI
#requires -version 4
<#
.SYNOPSIS
Seaches for an RDM with the specified LUN ID.
.DESCRIPTION
Searches the vCenter environment to find the Virtual Machine that has an RDM configured with a particular LUN ID.
.PARAMETER None
@9to5IT
9to5IT / Set-HostSNMP.ps1
Created June 7, 2016 13:03
PowerShell: Configure SNMP on an ESXi Host
#requires -version 4
<#
.SYNOPSIS
Configure SNMP Settings on ESXi Hosts
.DESCRIPTION
Connect to vCenter Server and configure all ESXi hosts with SNMP settings
.PARAMETER None
@tykurtz
tykurtz / grokking_to_leetcode.md
Last active May 5, 2024 19:18
Grokking the coding interview equivalent leetcode problems

GROKKING NOTES

I liked the way Grokking the coding interview organized problems into learnable patterns. However, the course is expensive and the majority of the time the problems are copy-pasted from leetcode. As the explanations on leetcode are usually just as good, the course really boils down to being a glorified curated list of leetcode problems.

So below I made a list of leetcode problems that are as close to grokking problems as possible.

Pattern: Sliding Window

@9to5IT
9to5IT / Find-RegistryValues.ps1
Created June 23, 2016 12:06
PowerShell: Enumerate & Search Registry Key values with PowerShell
$RegKey = (Get-ItemProperty 'HKCU:\Volatile Environment')
$RegKey.PSObject.Properties | ForEach-Object {
If($_.Name -like '*View*'){
Write-Host $_.Name ' = ' $_.Value
}
}
@9to5IT
9to5IT / Manage-ADUsers.ps1
Created July 4, 2016 12:04
PowerShell: Cleanup Inactive AD User Accounts
Import-Module ActiveDirectory
# Set the number of days since last logon
$DaysInactive = 90
$InactiveDate = (Get-Date).Adddays(-($DaysInactive))
#-------------------------------
# FIND INACTIVE USERS
#-------------------------------
# Below are four options to find inactive users. Select the one that is most appropriate for your requirements:
@9to5IT
9to5IT / Manage-ADComputers.ps1
Created July 4, 2016 12:06
PowerShell: Cleanup inactive AD computer objects
Import-Module ActiveDirectory
# Set the number of days since last logon
$DaysInactive = 90
$InactiveDate = (Get-Date).Adddays(-($DaysInactive))
#-------------------------------
# FIND INACTIVE COMPUTERS
#-------------------------------
# Below are three options to find inactive computers. Select the one that is most appropriate for your requirements:
@9to5IT
9to5IT / Manage-ADGroups.ps1
Created July 4, 2016 12:08
PowerShell: Cleanup empty AD Groups
Import-Module ActiveDirectory
#-------------------------------
# FIND EMPTY GROUPS
#-------------------------------
# Get empty AD Groups within a specific OU
$Groups = Get-ADGroup -Filter { Members -notlike "*" } -SearchBase "OU=GROUPS,DC=testlab,DC=com" | Select-Object Name, GroupCategory, DistinguishedName
#-------------------------------
@9to5IT
9to5IT / Manage-ADOUs.ps1
Created July 4, 2016 12:09
PowerShell: Cleanup empty AD OUs
Import-Module ActiveDirectory
#-------------------------------
# FIND EMPTY OUs
#-------------------------------
# Get empty AD Organizational Units
$OUs = Get-ADOrganizationalUnit -Filter * | ForEach-Object { If ( !( Get-ADObject -Filter * -SearchBase $_ -SearchScope OneLevel) ) { $_ } } | Select-Object Name, DistinguishedName
#-------------------------------