Skip to content

Instantly share code, notes, and snippets.

View perXautomatik's full-sized avatar

perXautomatik

View GitHub Profile
@perXautomatik
perXautomatik / TestWithNodeJs.ps1
Last active June 5, 2023 19:21
javascript - Converting Tree Like File Directory to a JSON object - Stack Overflow
#Url https://stackoverflow.com/questions/51228768/converting-tree-like-file-directory-to-a-json-object'
cd 'B:\ToGit\DirToJson'
node javascript-converting-tree-like-file-directory-to-a-json-object-stack-overflow.js
<#
.SYNOPSIS
Adapted setup ps1 file from https://gist.github.com/mikepruett3/7ca6518051383ee14f9cf8ae63ba18a7/
.DESCRIPTION
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://gist.githubusercontent.com/Xyn0gen/ba6d61a4397bb45eaf3d9f216e63f047/raw/setup.ps1'))"
.NOTES
**NOTE** Will configure the Execution Policy for the "CurrentUser" to Unrestricted.
#>
$VerbosePreference = "Continue"
#Requires -RunAsAdministrator
function wait_input_before_exit()
{
if ($Host.Name -eq "ConsoleHost")
{
Write-Host "Press any key to continue...."
$Host.UI.RawUI.FlushInputBuffer() # Make sure buffered input doesn't "press a key" and skip the ReadKey().
$Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyUp") > $null
}
#Requires -Version 5
#Requires -RunAsAdministrator
[CmdletBinding()]
param (
[Parameter()]
[ValidateSet("Minimal", "Basic", "Full")]
$Plevel
)
Write-Output "Level: $Plevel"
function Write-Error([string]$message) {
@perXautomatik
perXautomatik / restore.ps1
Created May 16, 2023 22:37 — forked from carlzoo/restore.ps1
Restore files in Recycling Bin by Deletion Date
#https://stackoverflow.com/questions/52031528/powershell-get-deleted-files-of-a-folder
#https://jdhitsolutions.com/blog/powershell/7024/managing-the-recycle-bin-with-powershell/
#https://stackoverflow.com/questions/16906170/create-directory-if-it-does-not-exist
New-Variable -Name 'ssfBITBUCKET' -Option Constant -Value 0x0A;
New-Variable -Name 'BitBucketDetails_Name' -Option Constant -Value 0;
New-Variable -Name 'BitBucketDetails_ParentPath' -Option Constant -Value 1;
New-Variable -Name 'BitBucketDetails_DeletionTimeText' -Option Constant -Value 2;
New-Variable -Name 'BitBucketDetails_SizeText' -Option Constant -Value 3;
New-Variable -Name 'BitBucketDetails_Type' -Option Constant -Value 4;
New-Variable -Name 'BitBucketDetails_LastWriteTimeText' -Option Constant -Value 5;
@perXautomatik
perXautomatik / what-is-spot-welding-a-complete-welding-process-guide-twi.md
Created February 18, 2023 15:33
What is Spot Welding? (A Complete Welding Process Guide) - TWI

Materials Appropriate for Spot Welding

Due to its lower thermal conductivity and higher electrical resistance, steel is comparatively easy to spot weld, with low carbon steel being most suited to spot welding. However, high carbon content steels (Carbon equivalence > 0.4wt%) are prone to poor fracture toughness or cracking in the welds as they tend to form hard and brittle microstructures.

Galvanised steel (zinc coated) requires slightly higher welding currents to weld than uncoated steels.  Also, with zinc alloys, the copper electrodes rapidly degrade the surface and lead to a loss of weld quality. When spot welding zinc coated steels, electrodes must either be frequently exchanged or the electrode tip surface should be ‘dressed’, where a cutter removes contaminated material to expose a clean copper surface and reshapes the electrode. 

Other materials commonly spot welded include stainless steels (in particular austenitic and ferritic grades), nickel alloys and titanium.

Although aluminium has a thermal

@perXautomatik
perXautomatik / git_add_submodule.md
Last active August 25, 2023 23:58 — forked from ShenTengTu/git_add_submodule.ps1
[Powershell] Add Git Submodule from .gitmodules

Write-Host "[Add Git Submodule from .gitmodules]" -ForegroundColor Green Write-Host "... Dump git_add_submodule.temp ..." -ForegroundColor DarkGray git config -f .gitmodules --get-regexp '^submodule..*.path$' > git_add_submodule.temp

Get-content git_add_submodule.temp | ForEach-Object { try { $path_key, $path = $_.split(" ") $url_key = "$path_key" -replace ".path",".url" $url= git config -f .gitmodules --get "$url_key" Write-Host "$url --> $path" -ForegroundColor DarkCyan

@perXautomatik
perXautomatik / correctly-check-if-a-process-is-running-and-stop-it.ps1
Last active January 30, 2023 09:28
powershell - How to Correctly Check if a Process is running and Stop it - Stack Overflow
# get Firefox process
$firefox = Get-Process firefox -ErrorAction SilentlyContinue
if ($firefox) {
# try gracefully first
$firefox.CloseMainWindow()
# kill after five seconds
Sleep 5
if (!$firefox.HasExited) {
$firefox | Stop-Process -Force
}
@perXautomatik
perXautomatik / Compare-DFStoFolders.ps1
Created January 17, 2023 12:31 — forked from markwragg/Compare-DFStoFolders.ps1
Powershell script to get a list of DFS folder targets for all DFS folders under a defined path and test if those paths are valid from the location running the script.
$Servers = @("SERVER01","SERVER02","SERVER03")
$FolderPaths = $Servers | foreach {
Get-ChildItem "\\$_\DFSShare$"
} | Sort Path
$FolderPaths | Export-Csv "FolderPaths-$(Get-Date -format yyyy-MM-dd).csv" -NoTypeInformation
$TestPaths = (($FolderPaths).FullName | Sort-Object).Trimend('\')
$DFSPaths = ((Import-CSV "DFS-$(Get-Date -format yyyy-MM-dd).csv").TargetPath | Where-Object {($_ -ilike "*SERVER*") | Sort-Object).Trimend('\')
@perXautomatik
perXautomatik / JEWebDav.ps1
Created January 15, 2023 18:18 — forked from darkquasar/JEWebDav.ps1
Simple WebDav Server in Powershell
<#
Obtained from https://github.com/re4lity/subTee-gits-backups/blob/master/JEWebDav.ps1
#>
<#
.SYNOPSIS
Simple Reverse Shell over HTTP. Deliver the link to the target and wait for connectback.
Read And Write Files Over WebDAV Proof Of Concept