Skip to content

Instantly share code, notes, and snippets.

View Iristyle's full-sized avatar

Ethan J. Brown Iristyle

View GitHub Profile
@Iristyle
Iristyle / gist:2501208
Created April 26, 2012 17:38
WinRM - Import module source files to remote machine
function Export-SourceModulesToSession
{
Param(
[Management.Automation.Runspaces.PSSession]
[ValidateNotNull()]
$Session,
[IO.FileInfo[]]
[ValidateNotNull()]
[ValidateScript(
@Iristyle
Iristyle / gist:2722455
Created May 18, 2012 00:34
Powershell Nuget Bootstrap
param([string] $destination = "$(Get-Location)")
$client = New-Object System.Net.WebClient
$results = [xml]$client.DownloadString('http://packages.nuget.org/v1/FeedService.svc/Packages()?$filter=Id eq ''NuGet.CommandLine''&$orderby=Published desc&$top=1')
$path = "${Env:Temp}\nuget.zip"
$client.DownloadFile($location.feed.entry.content.src, $path)
$shellApplication = New-Object -com Shell.Application
$zipItems = $shellApplication.NameSpace($path).Items()
$extracted = "${Env:temp}\nuget"
if (!(test-path $extracted)) { [Void](New-Item $extracted -type directory) }
@Iristyle
Iristyle / Tail-Content.ps1
Created May 18, 2012 21:43
Powershell Tail-Content
<#
.NOTES
AUTHOR: Keith Hill, r_keith_hill@hotmail.com
DATE: Jan 25, 2009
NAME: Tail-Content.ps1
LICENSE: BSD, http://en.wikipedia.org/wiki/BSD_license
Copyright (c) 2009, Keith Hill
All rights reserved.
Redistribution and use in source and binary forms, with or without
@Iristyle
Iristyle / SublimeLinter (dark) - Default Colors.jpg
Created August 15, 2012 14:17
Sample color demos for TextMate Solarized theme with Sublime Linter
SublimeLinter (dark) - Default Colors.jpg
@Iristyle
Iristyle / C (dark) New.jpg
Created August 15, 2012 17:09
Standardized Solarized Colors
C (dark) New.jpg
@Iristyle
Iristyle / BootstrapCanary.ps1
Created August 20, 2012 20:58
Bootstrap Chrome Canary on Windows - No Worky!
$chromeExtensions = @'
{
"extensions": {
"settings": {
"fdmmgilgnpjigdojojpjoooidkmcomcm": {
"active_permissions": {
"api": [ "cookies" ],
"explicit_host": [ "http://*/*", "https://*/*" ],
"scriptable_host": [ "http://getpostman.com/*", "https://getpostman.com/*" ]
},
@Iristyle
Iristyle / Update-SessionEnvironment.ps1
Created September 16, 2012 14:02
Update the Powershell environment variables based on system state
function Update-SessionEnvironment {
$user = 'HKCU:\Environment'
$machine ='HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'
#ordering is important here, $user comes after so we can override $machine
$machine, $user |
Get-Item |
% {
$regPath = $_.PSPath
$_ |
@Iristyle
Iristyle / Get-HyperVAddresses.ps1
Created September 26, 2012 17:17
Hyper-V IP addresses
$vmParams = @{
NameSpace = 'Root\Virtualization';
Query = 'SELECT * FROM Msvm_KvpExchangeComponent' #pulls VM WMI object ExchangeComponents
}
Get-WmiObject @vmParams |
% {
$xml = [Xml]"<properties>$($_.GuestIntrinsicExchangeItems)</properties>"
$xml.properties.INSTANCE.Property |
% {
@Iristyle
Iristyle / nsc_check_longrunning_processes.ps1
Created September 26, 2012 17:29
A PowerShell script that emits Nagios compatible output when asked max number of processes running (over a certain amount of time) - use with NSClient++
Param(
[Parameter(Mandatory=$true, ValueFromPipeline=$true)]
[string]
$Process,
[Parameter(Mandatory=$true)]
#[string]
[ValidatePattern("^(\d\.){0,1}(([0|1]\d)|(2[0-3])):[0-5]\d:[0-5]\d")]
$TimeSpan,
@Iristyle
Iristyle / Get-UserEnvironments.ps1
Created October 29, 2012 15:38
Get a list of user environment variables
# Note that this only works for user keys that are *loaded* and that you have access to
New-PSDrive HKU Registry HKEY_USERS
Get-ChildItem HKU: -ErrorAction SilentlyContinue |
% { Write-Host "`n`nEnvironment variables for $_"; Get-ItemProperty "HKU:\$_\Environment" -ErrorAction SilentlyContinue }