Skip to content

Instantly share code, notes, and snippets.

Avatar

Ethan J. Brown Iristyle

  • Puppet, Inc.
  • Portland, OR
View GitHub Profile
View Microsoft.PowerShell_profile.ps1
Push-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)
# Load posh-hg module from current directory
#Import-Module .\posh-hg
# If module is installed in a default location ($env:PSModulePath),
# use this instead (see about_Modules for more information):
Import-Module posh-hg
# Set up a simple prompt, adding the hg prompt parts inside hg repos
@Iristyle
Iristyle / .hgignore
Created Oct 3, 2011
Standard Mercurial Ignore file for .NET
View .hgignore
syntax: glob
*.*scc
*.FileListAbsolute.txt
*.aps
*.bak
*.[Cc]ache
*.clw
*.eto
*.exe
@Iristyle
Iristyle / check_longrunning_processes.ps1
Created Oct 11, 2011
Show processes running longer than X (for NSClient++ with OpsView or Nagios nrpe)
View check_longrunning_processes.ps1
Param(
[Parameter(Mandatory=$true, ValueFromPipeline=$true)]
[string]
$Process,
[Parameter(Mandatory=$true, ValueFromPipeline=$true)]
#[string]
[ValidatePattern("^(\d\.){0,1}(([0|1]\d)|(2[0-3])):[0-5]\d:[0-5]\d")]
$TimeSpan,
@Iristyle
Iristyle / install-graphite-ubuntu-11.10.sh
Created Nov 12, 2011
Install Graphite 0.9.9 on Ubuntu 11.10 on EC2 with NGinx, uwsgi, supervisord, statsite, nagios agent
View install-graphite-ubuntu-11.10.sh
#!/bin/bash
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# Forked from: http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Ubuntu 11.10 Oneiric Ocelot
# Forked from https://gist.github.com/1287170
# Modified to use NGinx + uwsgi instead of Apache, as well as memcached and supervisord, incorporating ideas from
# http://blog.adku.com/2011/10/scalable-realtime-stats-with-graphite.html
@Iristyle
Iristyle / gist:1644792
Created Jan 20, 2012
Bitbucket Jenkins API Source
View gist:1644792
import string, urllib
from django.utils.http import urlencode
try:
from brokers import BaseBroker
except ImportError:
BaseBroker = object
class URLOpener(urllib.FancyURLopener):
@Iristyle
Iristyle / Bootstrap-EC2-Windows-CloudInit.ps1
Created Jan 24, 2012
Bootstrap Windows EC2 node with WinRM and CloudInit for making your own AMI
View Bootstrap-EC2-Windows-CloudInit.ps1
# Windows AMIs don't have WinRM enabled by default -- this script will enable WinRM
# AND install the CloudInit.NET service, 7-zip, curl and .NET 4 if its missing.
# Then use the EC2 tools to create a new AMI from the result, and you have a system
# that will execute user-data as a PowerShell script after the instance fires up!
# This has been tested on Windows 2008 R2 Core x64 and Windows 2008 SP2 x86 AMIs provided
# by Amazon
#
# To run the script, open up a PowerShell prompt as admin
# PS> Set-ExecutionPolicy Unrestricted
# PS> icm $executioncontext.InvokeCommand.NewScriptBlock((New-Object Net.WebClient).DownloadString('https://raw.github.com/gist/1672426/Bootstrap-EC2-Windows-CloudInit.ps1'))
@Iristyle
Iristyle / gist:1776477
Created Feb 9, 2012
CloudInit.NET script for Windows Core 2008 R2 with IIS, .NET 4 and WebDeploy 2.0
View gist:1776477
#! /powershell/
Set-StrictMode -Version Latest
$log = 'c:\cloudfu.txt'
Add-Content $log -value "Initial Execution Policy: [$(Get-ExecutionPolicy)]"
Set-ExecutionPolicy Unrestricted
Add-Content $log -value "New Execution Policy: [$(Get-ExecutionPolicy)]"
Add-Content $log -value "Path variable [${env:Path}]"
Add-Content $log -value "PSModulePath variable [${env:PSModulePath}]"
@Iristyle
Iristyle / gist:1870431
Created Feb 20, 2012
WinRM alias for Microsoft.Powershell_Profile.ps1 to hide the ugliness that is starting a remote session
View gist:1870431
function Start-RemoteSession
{
param(
[parameter(Mandatory=$true)]
[string] $HostName,
[parameter(Mandatory=$true)]
[string] $UserName,
[parameter(Mandatory=$true)]
@Iristyle
Iristyle / gist:2045205
Created Mar 15, 2012
Standard document onReady script queue
View gist:2045205
<!-- concepts from http://samsaffron.com/archive/2012/02/17/stop-paying-your-jquery-tax -->
<!-- for head -->
<script type='text/javascript'>
window.$ = (function() {
var q = [], f = function (cb) {
q.push(cb);
};
f.attachReady = function ($) {
$(function () {
$.each(q, function(i, f) {
@Iristyle
Iristyle / gist:2500044
Created Apr 26, 2012
Enabling WinRM on a domain machine with VMWare NICs
View gist:2500044
#If having problems when enabling WinRM on a domain connected machine that is running VMWare VMs, the NICs must be properly configured
#http://powertoe.wordpress.com/2009/12/28/enable-powershell-remoting-while-running-vmware-workstation-in-a-domain/
$nlm = [Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]"{DCB00C01-570F-4A9B-8D69-199FDBA5723B}"))
$nlm.getnetworkconnections() | ? { $_.getnetwork().getcategory() -eq 0 } |
% { $_.getnetwork().setcategory(1) }
You can’t perform that action at this time.