Enter this in the search box along with your search terms:
Get all gists from the user santisbon.
user:santisbon
or
user:@me
Find all gists with a .yml extension.
extension:yml
Enter this in the search box along with your search terms:
Get all gists from the user santisbon.
user:santisbon
or
user:@me
Find all gists with a .yml extension.
extension:yml
| # From https://stackoverflow.com/a/9866769/370611 | |
| # (Obviously, make sure you're not dealing with a Unicode file.) | |
| foreach ($f in (Get-ChildItem *.log)) { | |
| (Get-Content $f) -replace "`0", "" | Set-Content $f | |
| } |
| (defun tabs-to-table () | |
| "Turns a block of tab-delimited text (either the entire buffer or the region, if active) into an org-mode table. | |
| Note that this function will operate on the lines the region touches, so it may stray outside the region." | |
| (interactive) | |
| (require 'org-table) | |
| (save-excursion | |
| (let* ((char-begin (if (use-region-p) (region-beginning) (point-min))) | |
| (char-limit (if (use-region-p) (region-end) (point-max))) | |
| end-marker | |
| ) |
| The program to run is: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe (or wherever the PS executable is on your system) | |
| The arguments are: -NoProfile -File Run-ScheduledScript.ps1 | |
| Run-ScheduledScript is where you redirect all your output streams to a log file using the '*>' PowerShell redirect operator | |
| (or some variant thereof). | |
| Maybe "*>&1" to merge everything to the SUCCESS stream, followed by "| Out-File -width 200 -encoding oem" or something equally creative. |
| <# | |
| .SYNOPSIS | |
| Process pipeline junk | |
| .DESCRIPTION | |
| Longer description of script/cmdlet/function goes here. | |
| .EXAMPLE | |
| Sample usages, if helpful. Can be repeated for multiple examples. | |
| .NOTES | |
| [Stuff of interest not necessarily required as part of Description section. Could maybe put futures/todos here. | |
| # Six hours. | |
| $PSSessionOption.IdleTimeout = New-Object TimeSpan 6,0,0 |
| # From https://medium.com/the-new-control-plane/generating-self-signed-certificates-on-windows-7812a600c2d8 | |
| # ----------------------------------------------------- Creation ----------------------------------------------------- | |
| $cert = New-SelfSignedCertificate ` | |
| -FriendlyName "John Lusk Self-signed" ` | |
| -KeyFriendlyName "John Lusk Self-signed Private Key" ` | |
| -NotAfter (get-date).AddYears(10) ` | |
| -Subject "John Lusk" ` | |
| -type CodeSigningCert ` |
| # --------------------------------------- Self-elevate the script if required. --------------------------------------- | |
| # | |
| # Physically include this in the client script, dot-sourcing will not work. | |
| # From https://blog.expta.com/2017/03/how-to-self-elevate-powershell-script.html, but I made a few modifications myself. | |
| # TODO: try making this a function. | |
| try { | |
| if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) { | |
| if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) { | |
| Write-Verbose ("cmd type: {0}" -f $MyInvocation.MyCommand.CommandType) |
| # The key is a parameterized script block. | |
| $expected = Invoke-Command -ComputerName $Machine -script { | |
| param($path) Get-ChildItem $path -rec | Measure-Object -prop length -sum } -args $CubePath |
| (PowerShell) | |
| > h | oss | sls subtree | |
| 316 git-subtree --help | |
| 317 git help subtree | |
| 326 git subtree add -P LoadTesting/k6 s:\JLusk-S\k6\.git | |
| 328 git subtree add -P LoadTesting/k6 s:\JLusk-S\k6\.git | |
| 329 git subtree add -P LoadTesting/k6 s:\JLusk-S\k6\.git HEAD | |