Skip to content

Instantly share code, notes, and snippets.

View Iristyle's full-sized avatar

Ethan J. Brown Iristyle

View GitHub Profile
@Iristyle
Iristyle / Server.wpp.targets
Created December 20, 2012 18:09
Add next to a Server.csproj file to influence ACLs during a WebDeploy package building by MSBuild. Note that we have specific paths in mind (based on this being for the Nuget server code)
<!--********************************************************************-->
<!-- RunCommand reference: http://technet.microsoft.com/en-us/library/ee619740(WS.10).aspx -->
<!-- http://blogs.msdn.com/b/webdevtools/archive/2010/02/09/how-to-extend-target-file-to-include-registry-settings-for-web-project-package.aspx -->
<!--********************************************************************-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<AfterAddContentPathToSourceManifest Condition="'$(AfterAddContentPathToSourceManifest)'==''">
$(AfterAddContentPathToSourceManifest);
ModifySiteManifest;
</AfterAddContentPathToSourceManifest>
@Iristyle
Iristyle / Gemfile
Created November 27, 2012 18:05 — forked from sr/Gemfile
Janky on Heroku / EC2 with Foreman - Configured for HipChat
source "http://rubygems.org"
gem "janky", :git => "git://github.com/github/janky.git", :ref => "fe546349504e581812853dcbf3b0977be61269bd"
gem "pg"
gem "thin"
gem "hipchat", "~>0.4"
@Iristyle
Iristyle / etc-init-elasticsearch.conf
Created November 13, 2012 01:28 — forked from jaytaylor/etc-init-elasticsearch.conf
Ubuntu upstart service script for ElasticSearch on EC2 Large instance
# ElasticSearch Service
description "ElasticSearch"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [016]
@Iristyle
Iristyle / gist:4049596
Created November 10, 2012 02:26 — forked from nickyp/gist:4045823
Map "Escape, Backspace" to Delete Word Backward in Sublime Text 2
// Maps Emacs style "Escape, Backspace" to Delete Word Backward
{ "keys": ["escape", "backspace"], "command": "delete_word", "args": { "forward": false, "sub_words": true },
"context":
[
{ "key": "setting.is_widget", "operator": "equal", "operand": false }
]
}
@Iristyle
Iristyle / New-ProfileFile.ps1
Created November 4, 2012 01:01
Can be used to write a files to user profile directories of various Windows system accounts - NetworkService, LocalService
function New-ProfileFile([byte[]]$Contents, [string]$Name, [string]$SubDir = '')
{
$profileRoot = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList'
$sysProfile = Join-Path 'config' 'systemprofile'
#system
(Get-ItemProperty "$profileRoot\S-1-5-18").ProfileImagePath,
#local service
(Get-ItemProperty "$profileRoot\S-1-5-19").ProfileImagePath,
#network service
@Iristyle
Iristyle / Get-Build2012Videos.ps1
Created November 3, 2012 12:21
Download Build 2012 Videos
#from http://lostechies.com/erichexter/2012/11/02/download-all-the-build-videos-while-you-sleep/
[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
$rss = (new-object net.webclient)
#Set the username for windows auth proxy
$rss.proxy.credentials=[system.net.credentialcache]::defaultnetworkcredentials
$a = ([xml]$rss.downloadstring("http://channel9.msdn.com/Events/Build/2012/RSS/wmvhigh"))
$a.rss.channel.item | foreach{
$url = New-Object System.Uri($_.enclosure.url)
$file = $url.Segments[-1]
@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 }
@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-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 / 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
$_ |