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
| [System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials | |
| Or: | |
| $wc = New-Object System.Net.WebClient | |
| $wc.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials | |
| $wc.Proxy.Address = "http://proxyurl" |
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
| DECLARE @SQL AS VARCHAR(255) | |
| DECLARE @SPID AS SMALLINT | |
| DECLARE @Loginname AS VARCHAR(500) | |
| DECLARE @HoursSinceLastBatch AS SMALLINT = 4 | |
| SET @Loginname = '<<Loginname>>' | |
| DECLARE Murderer CURSOR FOR | |
| SELECT spid FROM sys.sysprocesses WHERE loginame = @Loginname AND last_batch < DATEADD(HOUR, -1 * @HoursSinceLastBatch, GETDATE()) AND [status] = 'sleeping' ORDER BY last_batch DESC | |
| OPEN Murderer |
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
| # Get filenames from files in serveral subfolders that have a specific range for the LastWriteTime property | |
| $path = "FileSystem::\\path\to\files\**\in\several\subfolders" | |
| $start = Get-Date -Date "2017-06-27" | |
| $end = $start.AddDays(1) | |
| Get-ChildItem -Path $path -Recurse | ` | |
| Where-Object { $_.LastWriteTime -ge $start -and $_.LastWriteTime -le $end } | ` | |
| Select-Object { $_.Name } |
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
| #Open startup folder in windows (user or common) | |
| ##User | |
| - Run (WinKey+R) | |
| - shell:Startup | |
| ##Common | |
| - Run (WinKey + R) | |
| - shell:Common Startup |
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
| Get-ChildItem .\ -Include bin,obj -Recurse -Force | Remove-Item -Force -Recurse |
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
| $env:path = $env:path + ";C:\Windows\Microsoft.NET\Framework64\v4.0.30319" | |
| $env:path = $env:path + ";C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE" | |
| $env:path = $env:path + ";C:\Program Files (x86)\Vim\vim73" | |
| . (Resolve-Path "$env:LOCALAPPDATA\GitHub\shell.ps1") | |
| & 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat' x86 | |
| # Change the prompt to show only the current folder using a different color | |
| function prompt { | |
| $p = Split-Path -leaf -path (Get-Location) | |
| Write-Host "$p> " -nonewline -foregroundcolor Green |
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
| var connect = require('connect'); | |
| connect.createServer( | |
| connect.static(__dirname) | |
| ).listen(8080); |
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 prompt { | |
| $p = Split-Path -leaf -path (Get-Location) | |
| Write-Host "$p> " -nonewline -foregroundcolor Green | |
| return ' ' | |
| } |