This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# calling the wslMount function will attach one or more physical disks to a wsl instance | |
-drives | |
This parameter specifies which disks, and is an array of what Windows calls the Friendly Name. | |
You can see these by calling `Get-PhysicalDisk`. | |
-count | |
The list of friendly names are not necessarily unique (eg if you have multiple of the same model of drive). | |
Count is required so that you know how many disks have been matched, and will be passed to WSL. | |
-wsl | |
The name of the wsl install you want to interact with, defaults to the default wsl instance. | |
-mount |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
#Required: | |
Install-Module -Name LoopbackAdapter -MinimumVersion 1.2.0.0 | |
#run in admin terminal | |
#you do NOT need to disable/remove SMB 1.0/CIFS | |
#Troubleshooting: | |
#You can check [attempted] forwardings and [successful] listeners here, respectively | |
netsh interface portproxy show v4tov4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#accepts all arguments for ssh except command, -N and -f | |
#command can be piped in | |
Filter ssh-f { | |
$N = $False | |
if (!$_) { | |
#the same as -N | |
$_ = 'read' | |
$N = $True | |
} | |
$_ = 'echo SUCCESS;' + $_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#https://gist.github.com/Hashbrown777/a5a02e2fd3eeed4485d4ba073ef3b143 | |
. "$PSScriptRoot/async.ps1" | |
. "$PSScriptRoot/files.ps1" | |
. "$PSScriptRoot/style.ps1" | |
#default switches of $True emulate grep/ag behaviour, use `-flag:$False` to disable | |
Function Grep { [CmdletBinding(PositionalBinding=$False)]Param([Parameter(ValueFromPipeline)]$Input, | |
#display params | |
[switch]$OnlyMatching, [switch]$Files, $Max=-1, | |
#async params |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat /dev/urandom \ | |
| tr -dc '[:upper:][:digit:]' \ | |
| fold -w ${1:-8} \ | |
| head -1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pdfimages -all big.pdf . #poppler-utils | |
rename -v 's/^[^0-9]*//' .*.jpg | |
convert '*.jpg' -resize 50% %03d.jpeg #imagemagick | |
convert '*.jpeg' small.pdf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(async () => { | |
const output = open().document; | |
//generate a script to run over your deluge state file | |
output.write( | |
`<pre>#!/bin/bash | |
mkdir _ | |
cd _ | |
#split up the file and name them correctly, disregard the byte-counts | |
awk \\ | |
'BEGIN { RS="[de]40:"; ORS=FS=":" } { if ($1 != "") { for (i = 2; i <= NF; i++) print $i > substr($1, 0, 40) } }' \\ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
&{ Param($hostname, $port) | |
try { | |
$tmp = [Net.Sockets.TcpClient]::new($hostname, $port) | |
$tmp.Connected | |
$tmp.close() | |
return | |
} | |
catch [System.Net.Sockets.SocketException] { | |
$Error[0].Exception | Out-Host | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sort(array, radix, getDigit) { | |
const counts = new Uint32Array(radix); | |
const jobs = [{start:0, end:array.length, offset:0}]; | |
while (jobs.length) { | |
const {start, end, offset} = jobs.pop(); | |
counts.fill(0); | |
counts[null] = start; | |
const sorting = array.slice(start, end); | |
for (let index = 0; index < sorting.length; ++index) { |