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
| cd $env:LOCALAPPDATA | |
| ( | |
| 'Ubisoft*', | |
| 'Grip', | |
| 'Evil*', | |
| 'ride3', | |
| 'Squad*', | |
| 'Remnant', | |
| 'Mordhau', | |
| 'Dead*', |
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
| class RC { | |
| hidden $type = $NULL | |
| hidden $code = $NULL | |
| hidden $size = $NULL | |
| hidden RC($type) { | |
| $this.type = $type | |
| $this.size = $type::New(1)[0]::MaxValue + 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
| try { | |
| Switch ($args[0]) { | |
| #entrypoint | |
| $NULL { | |
| if (!(Start-Process ` | |
| -FilePath 'PsExec' ` | |
| -ArgumentList ( | |
| '-s', | |
| '-nobanner', | |
| '-accepteula', |
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
| //go to one of your lists, eg https://superuser.com/users/saves/241800 | |
| $('.s-block-link.js-unsave').click() | |
| //NO NEED TO USE THIS | |
| (async (links) => { | |
| const request = { | |
| body : 'fkey=' + localStorage['se:fkey'].replace(/,.*$/, ''), | |
| method : 'POST', |
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
| $from = $from | gi | |
| $to = ($to | gi).FullName | |
| $from ` | |
| | Get-ChildItem -File -Recurse ` | |
| | &{ | |
| Begin { | |
| $from = '^' + [Regex]::Escape($from.FullName) | |
| } | |
| Process { |
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
| while ((Get-CimInstance Win32_Battery).EstimatedChargeRemaining -gt 55) { sleep 60 } shutdown -s -t 0 |
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
| //leaves only the unique elements in two sorted arrays | |
| function diff(bob, steve) { | |
| for (let b = 0, s = 0; b < bob.length && s < steve.length; ++b, ++s) { | |
| if (bob[b] < steve[s]) | |
| --s; | |
| else if (bob[b] > steve[s]) | |
| --b; | |
| else { | |
| bob.splice(b--, 1); | |
| steve.splice(s--, 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
| $blockSize = 4KB | |
| $buffer=[byte[]]::new($blockSize) | |
| Get-ChildItem -File ` | |
| | Sort-Object -Property Length | |
| | %{ | |
| "$($_.Name)`t$($_.Length / 1MB -bor 0)MB" | |
| $path = $_.FullName | |
| #useful if your files are patchable eg torrent-sourced | |
| sudo cp --reflink=always $path "${path}_rescued" |
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
| $ErrorActionPreference = 'Stop' | |
| $shell = New-Object -ComObject 'Shell.Application' | |
| &{ | |
| gci -File ` | |
| | ?{ | |
| #leave these in the root directory | |
| $_.Name -notmatch '^(IMG_\d{4}.JPG|sort.ps1|Untitled.png)$' | |
| } | |