Skip to content

Instantly share code, notes, and snippets.

View justincjahn's full-sized avatar

Justin Jahn justincjahn

View GitHub Profile
@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
@justincjahn
justincjahn / README.md
Created April 26, 2012 18:44
NetworkManager 802.1x Autoconfiguration

Wireless Autoconfiguration

The purpose of this script is to automatically configure an 802.1x wireless network for the Yuma Union High School district for student access. Since NetworkManager requires the addition of an identity for the keyfile entry.

Installation

  1. Copy the python script to /usr/bin/wirelessautoconfig.py file.
  2. Set permissions of the file.
    • sudo chown root:root /usr/bin/wirelessautoconfig.py
  • sudo chmod 700 /usr/bin/wirelessautoconfig.py
@justincjahn
justincjahn / fixDialin.ps1
Created June 13, 2012 00:34
Bulk change mpAllowDialin property.
# Global Configuration
$sRoot = "DC=domain,DC=tld"
# Configure the query object
$oQuery = [ADSISearcher]"ObjectCategory=User"
$oQuery.PageSize = 500
$oQuery.searchroot = "LDAP://$sRoot"
# Configure the properties that should be queried
$oQuery.PropertiesToLoad.Clear()
@justincjahn
justincjahn / gist:3062860
Created July 6, 2012 21:32
Gitlab init.d for RedHat based distributions.
#!/bin/bash
#
# GitLab Runs unicorn and resque for nginx integration.
###
# chkconfig: 35 82 55
# processname: unicorn
# processname: resque
# description: Runs unicorn and resque for nginx integration.
###
@justincjahn
justincjahn / phpDoc.sh
Created July 26, 2012 22:41
Shell script to generate PHPDocumentor files.
#!/bin/bash
# The title of the documentation
TITLE='PHPDocumentor'
# If highlighted source code should be generated
SOURCE='off'
# If private tags are to be parsed
PRIVATE='on'
@justincjahn
justincjahn / README.md
Created July 26, 2012 22:47
Mass configure switches using expect.

Usage Documentation

Multiple Switches

./batch.sh ip1 ip2 ip3 ip4 ip5 ip5 ... 

You will be prompted for a username and password, and asked to verify
that the servers you've selected are really the ones you want to run
these commands on.
@justincjahn
justincjahn / README.md
Created July 26, 2012 22:55
Address validation using Google Maps

Google Maps Address Verification

The HTML and accompanying scripts in this project demonstrate how to present users with a "did you mean..." style address validation mechanism that helps to ensure accurate addresses for sites that need said information.

Google Maps API Key

The script will need your own API key to function, my key has been redacted.

@justincjahn
justincjahn / generateNat.pl
Created July 26, 2012 23:08
FortiGate: Generate NAT configuration from given parameters.
#!/usr/bin/env perl -w
use strict;
use Getopt::Long;
use Pod::Usage;
# Configuration
my %config = (
'name' => undef,
'externalIp' => undef,
@justincjahn
justincjahn / hpLabel.pl
Created July 26, 2012 23:09
Change LCD screen on an HP printer.
#!/usr/bin/env perl
use strict;
use IO::Socket;
#
# Check to see if an element is in a given array.
#
# @param string $strNeedle The string to search for.
# @param array @arrHaystack The array to look in. Defaults to @ARGV.
@justincjahn
justincjahn / gist:3649783
Last active October 10, 2015 06:47
List Active Directory Users and Groups
Get-ADUser -Filter * -Properties MemberOf | select @{n="Username";e={$_.Name}},@{n="SID";e={$_.SID}},@{n="Security Groups";e={($_.MemberOf | Where-Object {($_ | get-adgroup).GroupCategory -eq "Security"} | Foreach-Object { ($_ | get-adgroup).Name}) -join "; "}},@{n="Distribution Groups";e={($_.MemberOf | Where-Object {($_ | get-adgroup).GroupCategory -eq "Distribution"} | Foreach-Object { ($_ | get-adgroup).Name}) -join "; "}} | Export-Csv -NoTypeInformation C:\Users\jjahn\Documents\users.csv