Instantly share code, notes, and snippets.

Ryan Punt rpunt

View GitHub Profile
View phoh.ps1
$entries = @{}
import-csv $csv | % {
fname = $_."First Name"
lname = $_."Last Name"
department = $_.Department
location = $_.Location
manager = $_.Manager
title = $_."Job Title"
# New Relic deployment events
my $ua = LWP::UserAgent->new;
$response = $ua->request(POST '',
Content => [
'deployment[application_id]' => $APPID,
'deployment[description]' => 'deployment message',
'deployment[revision]' => $RELEASE_VERSION,
'deployment[user]' => 'Jenkins'
'x-api-key' => $APIKEY
View encode.ps1
$scandir = "d:\video"
$outputdir = "d:\encoded"
$filelist = Get-ChildItem $scandir -filter *.mkv -recurse
$num = $filelist | measure
$filecount = $num.count
$i = 0;
ForEach ($file in $filelist)
View gist:85ab824375936a2caebf
curl -o /var/www/file.crl
lastmod=`openssl crl -inform DER -text -noout -in /var/www/file.crl | grep "Last Update" | awk '{ print "date -d \""$3FS$4FS$5FS$6"\" +%Y%m%d%H%M" }' | bash`
touch -mt $lastmod /var/www/file.crl
View PowerShell Console Transcript.ps1
$log=Join-Path (Get-ChildItem $MyInvocation.MyCommand.Definition).Directory (Get-ChildItem $MyInvocation.MyCommand.Definition).Basename
Start-Transcript "$log.log"
View Verify User Credentials.ps1
param (
$computer = gc env:computername
# did you enter valid credentials for a local user?
# This is a preseed partman recipe that will later allow the created on
# LVM-on-software-RAID, somethat that wasn't possible directly in the
# preseed at the time (~2003)
d-i lvmcfg/activevg boolean false
d-i lvmcfg/vgdelete_names select vg00
d-i lvmcfg/vgcreate_name string vg00
d-i lvmcfg/vgdelete_confirm boolean true
d-i partman-auto/method string lvm
d-i partman-lvm/device_remove_lvm boolean true
// Retrieve a list of roomlists from Exchange 2010 via SOAP.
// This method then uses SMXMLDocument to retrieve the e-mail addresses for those roomlists,
// which can be used to query the individual rooms
// DEPENDENCIES: AFNetworking v1 (
// SMXMLDocument (
// NOTE: I used AFHTTPRequestOperation instead of AFXMLRequestOperation because I wanted the XML, not an XML parser
// (which is what AFXMLRequestOperation returns)
- (void) readRoomLists {
// for some reason, Exchange Web Services seems to ignore the DST-specific bias settings, and only refer to the
// master bias.
// set the master bias here.
int bias = abs([[NSTimeZone systemTimeZone] secondsFromGMT] / 60);
NSString *soapMessage = [NSString stringWithFormat:@""
@"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
@"<soap:Envelope xmlns:xsi=\"\" xmlns:xsd=\"\" xmlns:soap=\"\" xmlns:t=\"\">"
@"<GetUserAvailabilityRequest xmlns=\"\" xmlns:t=\"\">"
// given the e-mail address of a roomlist, this SOAP message will retrieve the member rooms.
NSString *roomlist = @"roomlist1@domain.tld" // this is the e-mail address of the room list you're querying
NSLog(@"querying roomlist %@", roomlist);
NSString *soapMessage = [NSString stringWithFormat:@""
@"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
@"<soap:Envelope xmlns:xsd=\"\" xmlns:soap=\"\" xmlns:t=\"\" xmlns:m=\"\">"
@"<t:RequestServerVersion Version =\"Exchange2010_SP2\"/>"