Skip to content

Instantly share code, notes, and snippets.

View thomasbiddle's full-sized avatar

TJ (Thomas J.) Biddle thomasbiddle

View GitHub Profile
@thomasbiddle
thomasbiddle / cancan-grape.rb
Created November 14, 2014 17:12
CanCan helper for a Grape API implementation
def authorize!(role={}, object)
ability = Ability.new(current_user)
unless ability.can?(role, object)
unauthorized!
end
end
@thomasbiddle
thomasbiddle / Create-Administrator.ps1
Last active December 28, 2017 23:42 — forked from ducas/Create-Administrator.ps1
Create a local administrator account using PowerShell
$Username = "su"
# Likely needs a capital letter, certain length and a number.
$Password = "TempPassword1"
$group = "Administrators"
$adsi = [ADSI]"WinNT://$env:COMPUTERNAME"
$existing = $adsi.Children | where {$_.SchemaClassName -eq 'user' -and $_.Name -eq $Username }