Skip to content

Instantly share code, notes, and snippets.

View neuralpain's full-sized avatar
💻
Solving problems.

neuralpain neuralpain

💻
Solving problems.
View GitHub Profile
@neuralpain
neuralpain / ghdt-crlf-fix.sh
Last active September 20, 2022 06:07
Bug fix for GitHub desktop changing line endings from LF to CRLF
# fix issue with GitHub desktop changing line endings from LF to CRLF
# go to Repository -> Open in {terminal}
# execute the code below in the exact order
git config core.eol lf
git config core.autocrlf input
@neuralpain
neuralpain / WSL-KALI-APT-UPDATE-ERROR.md
Created September 21, 2022 01:07 — forked from MooreDerek/WSL-KALI-APT-UPDATE-ERROR.md
Installing Kali on WSL getting apt update error

Installing Kali

wsl --install -d kali-linux

When terminal starts up try running

sudo apt upgrade and get the following error:

Get:1 http://wlglam.fsmg.org.nz/kali kali-rolling InRelease [30.6 kB]
Err:1 http://wlglam.fsmg.org.nz/kali kali-rolling InRelease
 The following signatures were invalid: EXPKEYSIG ED444FF07D8D0BF6 Kali Linux Repository 
@neuralpain
neuralpain / Compare-IsValidHash.ps1
Last active May 1, 2024 07:37
PowerShell: Get hash from file and compare against the original
function Compare-IsValidHash {
<#
.SYNOPSIS
Compares the file hash (MD5) of the specified file against the provided hash.
.DESCRIPTION
This function uses PowerShell's Get-FileHash cmdlet to retrieve the hash of the specified file.
It then compares the retrieved hash against the provided hash. If the two hashes match, the function returns $true,
otherwise it returns $false.
@neuralpain
neuralpain / cmdUAC.cmd
Last active February 13, 2024 14:06
Invoke UAC prompt for Windows Batch scripts.
:: fsutil [...] is a universal method for checking
:: administrator privilages. works from Windows XP
:: and onwards
fsutil dirty query %systemdrive% >nul
:: if error, we do not have admin.
if %ERRORLEVEL% NEQ 0 (
cls & echo.
echo This script requires administrative priviledges.
echo Attempting to elevate...
goto UAC_Prompt
@neuralpain
neuralpain / PwshBatch.cmd
Last active February 7, 2024 02:01
Run a PowerShell code block once in a batch script at any given time and return to Batch when done.
<# :# PowerShell comment protecting the Batch section
@echo off
:# Disabling argument expansion avoids issues with ! in arguments.
setlocal EnableExtensions DisableDelayedExpansion
:# Prepare the batch arguments, so that PowerShell parses them correctly
set ARGS=%*
if defined ARGS set ARGS=%ARGS:"=\"%
if defined ARGS set ARGS=%ARGS:'=''%
@neuralpain
neuralpain / README_LIGHT_DARK.txt
Last active June 12, 2024 15:03
README head logo proper light & dark theme template
<p align="center">
<picture>
<source srcset="https://cdn.example.com/logo-light.svg" media="(prefers-color-scheme: light)" height="96px" alt="logo light">
<img src="https://cdn.example.com/logo-dark.svg" height="96px" alt="logo dark">
</picture>
</p>
@neuralpain
neuralpain / cli_text_display_colors.sh
Last active February 8, 2024 01:27
Predefined functions for displaying colored CLI messages based on type, i.e., success, error and information
# extracted from: https://bun.sh/install
# https://github.com/oven-sh/bun
# Reset
Color_Off=''
# Regular Colors
Red=''
Green=''
Dim='' # White
@neuralpain
neuralpain / Get-FileFromWeb.ps1
Created October 8, 2023 01:34 — forked from ChrisStro/Get-FileFromWeb.ps1
Get-FileFromWeb | Function to show download progress in powershell
function Get-FileFromWeb {
param (
# Parameter help description
[Parameter(Mandatory)]
[string]$URL,
# Parameter help description
[Parameter(Mandatory)]
[string]$File
)
@neuralpain
neuralpain / Set-DpiAware.ps1
Created March 9, 2024 06:09
Add DPI awareness to Powershell-run .Net Windows Forms
using assembly System.Windows.Forms
using namespace System.Windows.Forms
using namespace System.Drawing
#Enable visual styles
[Application]::EnableVisualStyles()
#Enable DPI awareness
$code = @"
[System.Runtime.InteropServices.DllImport("user32.dll")]
@neuralpain
neuralpain / Invoke-URLInDefaultBrowser.ps1
Created March 14, 2024 10:39 — forked from jkdba/Invoke-URLInDefaultBrowser.ps1
PowerShell cmdlet to open a URL in the user's default browser.
function Invoke-URLInDefaultBrowser
{
<#
.SYNOPSIS
Cmdlet to open a URL in the User's default browser.
.DESCRIPTION
Cmdlet to open a URL in the User's default browser.
.PARAMETER URL
Specify the URL to be Opened.
.EXAMPLE