Skip to content

Instantly share code, notes, and snippets.

View Iristyle's full-sized avatar

Ethan J. Brown Iristyle

View GitHub Profile
@Iristyle
Iristyle / Microsoft.PowerShell_profile.ps1
Created August 29, 2011 15:20
Mercurial Powershell Prompt
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 October 3, 2011 16:40
Standard Mercurial Ignore file for .NET
syntax: glob
*.*scc
*.FileListAbsolute.txt
*.aps
*.bak
*.[Cc]ache
*.clw
*.eto
*.exe
@Iristyle
Iristyle / check_longrunning_processes.ps1
Created October 11, 2011 20:05
Show processes running longer than X (for NSClient++ with OpsView or Nagios nrpe)
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 November 12, 2011 18:40
Install Graphite 0.9.9 on Ubuntu 11.10 on EC2 with NGinx, uwsgi, supervisord, statsite, nagios agent
#!/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 January 20, 2012 03:27
Bitbucket Jenkins API Source
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 January 24, 2012 20:38
Bootstrap Windows EC2 node with WinRM and CloudInit for making your own AMI
# 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 February 9, 2012 02:03
CloudInit.NET script for Windows Core 2008 R2 with IIS, .NET 4 and WebDeploy 2.0
#! /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 February 20, 2012 18:15
WinRM alias for Microsoft.Powershell_Profile.ps1 to hide the ugliness that is starting a remote session
function Start-RemoteSession
{
param(
[parameter(Mandatory=$true)]
[string] $HostName,
[parameter(Mandatory=$true)]
[string] $UserName,
[parameter(Mandatory=$true)]
@Iristyle
Iristyle / gist:2045205
Created March 15, 2012 16:43
Standard document onReady script queue
<!-- 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 April 26, 2012 14:44
Enabling WinRM on a domain machine with VMWare NICs
#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) }