Skip to content

Instantly share code, notes, and snippets.

View Iristyle's full-sized avatar

Ethan J. Brown Iristyle

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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 / gist:5005653
Created February 21, 2013 15:53
Configure HAProxy for userlists

Create SHA512 passwords

# make sure to use a leading space so that the command is not stored in your bash history!!
 mkpasswd -m sha-512 password1
# generates -> $6$yMgsow58.g/Z$mBjHfdVzqcF/LN.iwV23Eyqg.yGPTsp9pOwaStsJ6c4I4zL7BhucVVAkv5guf7OVRr8Pw0mHF4NrWBRCG5ci7/
 mkpasswd -m sha-512 password2
# generates -> $6$RZ86vRkQ$aRKN1HOsk6bDHBbMhS7jSo/p1NGFl4PvwY3KpU.72i./LvITi41nL84EkxOFXl.6Bmhynj/L7pYbfF0rUHtOB0
@Iristyle
Iristyle / Start-Vagrant.bat
Created March 15, 2013 18:35
Windows startup script to fire up a Vagrant VM safely on boot (using Run registry key for instance)
ECHO OFF
cd /d %~dp0
for /f "tokens=2* delims= " %%F IN ('vagrant status ^| find /I "default"') DO (SET "STATE=%%F%%G")
ECHO Close this window if it remains open, and http://localhost:8081 is responsive
IF "%STATE%" NEQ "saved" (
ECHO Starting Vagrant VM from powered down state...
vagrant up
) ELSE (
@Iristyle
Iristyle / Ping-Redis.ps1
Created April 5, 2013 17:03
Powershell PING Redis
$client = New-Object Net.Sockets.TcpClient('localhost', 6379)
$stream = $client.GetStream()
$bytes = [Text.Encoding]::ASCII.GetBytes("PING`r`n")
$stream.Write($bytes, 0, $bytes.Length)
$buffer = New-Object byte[] 32
$read = $stream.Read($buffer, 0, 32)
$response = [Text.Encoding]::ASCII.GetChars($buffer) -join ''
Write-Host "Redis Response to PING: $response"
@Iristyle
Iristyle / Output-SuperWide.ps1
Created May 30, 2013 12:03
Filter PowerShell Output Width
# monkey path the built-in output system
filter Out-Default
{
$input |
Out-String -Width 500 -Stream |
Microsoft.PowerShell.Utility\out-default
}