Skip to content

Instantly share code, notes, and snippets.

View perXautomatik's full-sized avatar

perXautomatik

View GitHub Profile

a project based on a smart power switch that detects changes in light using a Raspberry Pi Pico:

Approximate time to do this tutorial: 1 hours

Smart Power Switch

Introduction

The purpose of this project is to create a smart power switch that can turn on or off an appliance based on the ambient light level. The project will use a Raspberry Pi Pico, a photoresistor, a relay module, and an LED to sense and control the power switch. The project will also use a web app to display the light level and the switch status on a web page.

@perXautomatik
perXautomatik / Ensure-Everything.ps1
Created August 14, 2023 08:00
a simple PowerShell script
��function Ensure-Everything {
# Define a function to search with void tools everything for the folder name and "child:config" and get the first result
<#
.SYNOPSIS
Searches with void tools everything for the folder name and "child:config" and returns the first result as an object with properties Name, Path, and FullPath.
.PARAMETER FolderName
The folder name to search with.
@perXautomatik
perXautomatik / tmp70AE.ps1
Created August 14, 2023 07:47
a simple PowerShell script
��function Ensure-Everything {
# Define a function to search with void tools everything for the folder name and "child:config" and get the first result
<#
.SYNOPSIS
Searches with void tools everything for the folder name and "child:config" and returns the first result as an object with properties Name, Path, and FullPath.
.PARAMETER FolderName
The folder name to search with.
@perXautomatik
perXautomatik / tmp66C3.ps1
Created August 14, 2023 07:45
a simple PowerShell script
��function Ensure-Everything {
# Define a function to search with void tools everything for the folder name and "child:config" and get the first result
<#
.SYNOPSIS
Searches with void tools everything for the folder name and "child:config" and returns the first result as an object with properties Name, Path, and FullPath.
.PARAMETER FolderName
The folder name to search with.
@perXautomatik
perXautomatik / tmpF2C3.ps1
Created August 14, 2023 06:30
a simple PowerShell script
��function Ensure-Everything {
# Define a function to search with void tools everything for the folder name and "child:config" and get the first result
<#
.SYNOPSIS
Searches with void tools everything for the folder name and "child:config" and returns the first result as an object with properties Name, Path, and FullPath.
.PARAMETER FolderName
The folder name to search with.
@perXautomatik
perXautomatik / CorruptedModulesCombinedWithQue.ps1
Last active August 7, 2023 10:31 — forked from mhagger/README.md
Tools for repository repair
begin
{
Push-Location
# Validate the arguments
if (-not (Test-Path -LiteralPath $modules)) {
Write-Error "Invalid modules path: $modules"
exit 1
}

Using shared data space

While working with git on major projects, one problem developers usually feel is the huge amount of data that is hosted in each working directory. For example, my busybox folder currently hosts 18MB of source code and 20MB in .git. While code can be compressed to 2.5MB, the git data is already compressed and remains 20MB.

As soon as you work on several branches at the same time, because you are following different use cases of the same software package, it's useful to have different folders, with different checkouts of the same project, to avoid switching branches too often, as each time you need to recompile everything, which takes time. In this situation, the amount of common history becomes an heavy load, both on the work disk and on the backup device. Clearly, most git objects are repeated in the various folders, as past history of the package is the same, and local differences across branches are relatively little.

To avoid such data duplication, git allows to specify ot

The MIT License (MIT)
Copyright (c) 2015 Iain Brighton
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
--show the top 10 pairs of folders that have the most files in common.
-- Create a CTE named folders that selects the group ID, folder and filename from dupes table
-- and adds a column named full_path that combines the folder and filename with a backslash
with folders as (
select [Group ID] as group_id, Folder || '\' || Filename as full_path from dupes
),
-- Create a CTE named split that recursively splits the full_path column into single characters
-- and appends them to a column named path_prefix, while keeping track of the last two characters
-- in columns last_char and common_denominator
@perXautomatik
perXautomatik / using-powershell-7-in-the-windows-powershell-ise.ps1
Last active May 23, 2023 12:33
Using PowerShell 7 in the Windows PowerShell ISE
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Clear()
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add("Switch to PowerShell 7", {
function New-OutOfProcRunspace {
param($ProcessId)
$ci = New-Object -TypeName System.Management.Automation.Runspaces.NamedPipeConnectionInfo -ArgumentList @($ProcessId)
$tt = [System.Management.Automation.Runspaces.TypeTable]::LoadDefaultTypeFiles()
$Runspace = [System.Management.Automation.Runspaces.RunspaceFactory]::CreateRunspace($ci, $Host, $tt)