Skip to content

Instantly share code, notes, and snippets.

View justincjahn's full-sized avatar

Justin Jahn justincjahn

View GitHub Profile
@justincjahn
justincjahn / gist:784decc3ec337ceafe94
Created June 20, 2014 18:33
Export SCSM Incidents including analyst and affected user names.
Import-Module SMLets
$IRClass = Get-SCSMClass -Name System.WorkItem.Incident
$ASClass = Get-SCSMRelationshipClass -Name System.WorkItemAssignedToUser$
$AFClass = Get-SCSMRelationshipClass -Name System.WorkItemAffectedUser$
$IR = Get-SCSMObject -Class $IRClass | Select -Property `
@{Label="Queue";Expression={$_.TierQueue.displayname}}, `
Id, `
Title, `
@justincjahn
justincjahn / gist:2223d4e916428507ea42
Created August 29, 2014 23:18
jQuery OAuth2 Bearer Login
$(function () {
$('#login').submit(function (e) {
e.preventDefault();
var formData = {
'grant_type': 'password',
'username': $('#username').val(),
'password': $('#password').val(),
'client_id': 'unknown',
'client_secret': 'unknown'
@justincjahn
justincjahn / date-range-picker.hbs
Last active August 29, 2015 14:06
Ember.js Bootstrap Date Range
{{input type="text" class="form-control date-picker date-start"}}
<span class="input-group-addon">to</span>
{{input type="text" class="form-control date-picker date-end"}}
<span class="clear-button glyphicon glyphicon-remove-circle form-control-feedback"></span>
@justincjahn
justincjahn / removeLine.sh
Created May 4, 2011 15:20
Script to remove lines using sed.
#!/usr/bin/env bash
#
# Very simple shell script that removes a line from a file
# using sed.
#
# Usage: removeline 13 /path/to/file
#
nParams=$#
@justincjahn
justincjahn / gist:956166
Created May 4, 2011 22:21
Colorful Command Prompt
### ALIASES ###
alias ls="ls -GF"
### END ALIASES ###
## COLORS ##
DULL=0
BRIGHT=1
FG_BLACK=30
FG_RED=31
@justincjahn
justincjahn / parseurl.pl
Created May 5, 2011 17:32
URL Parsing Regex
#!/usr/bin/env perl
use strict;
# Breakdown
# ([^?:]+):?([0-9]+)?\??([^#]+)?(#.*)?
# ([^?:]+) Matches the file path.
# :?([0-9]+)? Matches the port number (optional).
# \??([^#]+)? Matches the query string minus the ? (optional).
# (#.*)? Matches the anchor (optional).
@justincjahn
justincjahn / adlogin.aspx
Created February 2, 2012 23:45
AD Authentication
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Text.RegularExpressions" %>
<%@ Import Namespace="System.DirectoryServices" %>
<%@ Import Namespace="System.Web" %>
<%@ Page Language="C#" %>
<script language="c#" runat="server">
// Constants
const string AD_SERVER = "10.0.0.0";
const string AD_DOMAIN = "AD";
@justincjahn
justincjahn / serialconsole.applescript
Created April 3, 2012 18:51
GUI for serial connections.
tell me
# Focus the windows we are about to make
activate
#
# Ask the user what device they would like to use.
#
set strSerialDevices to (do shell script "ls /dev/tty.*")
set listDevices to (paragraphs of strSerialDevices) as list
set strDevice to (choose from list listDevices with prompt "Select Device:")
@justincjahn
justincjahn / dhcpSync.ps1
Created April 4, 2012 07:44
Poor man's DHCP sync.
<#
.SYNOPSIS
Safely restores DHCP Server scopes using the specified directory.
.DESCRIPTION
Performs a backup of the currently running DHCP Server to the given
directory. Pulls a reference backup from another location locally
and performs a restore operation.
Version: 0.0.1
@justincjahn
justincjahn / npsSync.ps1
Created April 13, 2012 01:02
Windows Server 2008 NPS Syncronization
<#
.SYNOPSIS
Safely restores NPS server configuration using the specified directory.
.DESCRIPTION
Performs a backup of the currently running NPS server and restores the
database from a remote location.
Version: 0.0.1
Author: Justin "4sak3n 0ne" Jahn