Skip to content

Instantly share code, notes, and snippets.

View caomai's full-sized avatar

Shawn Skriver caomai

  • St Charles, IL
  • 04:30 (UTC -05:00)
View GitHub Profile
@zenware
zenware / boxstarter.ps1
Last active May 14, 2024 04:29
Windows Quick Setup
# NOTE: Worst-Case Scenario I should be able to include the command to setup Chocolatey
# and the command to setup boxstarter at the top of this script
# And then provide a "download and run this script command"
# (Get-Host).Version
# (Get-WmiObject -Query 'SELECT * FROM Win32_OperatingSystem').Version
# Temporary Setup
Disable-UAC
Disable-MicrosoftUpdate
# More Permanent Setup -- https://boxstarter.org/WinConfig
@devigned
devigned / sp-w-cert-azps-1-0.ps1
Last active October 25, 2023 12:34
Create a service principal to auth with a certificate in Azure PowerShell 1.0
# Login to Azure PowerShell
Login-AzureRmAccount
# Create the self signed cert
$currentDate = Get-Date
$endDate = $currentDate.AddYears(1)
$notAfter = $endDate.AddYears(1)
$pwd = "P@ssW0rd1"
$thumb = (New-SelfSignedCertificate -CertStoreLocation cert:\localmachine\my -DnsName com.foo.bar -KeyExportPolicy Exportable -Provider "Microsoft Enhanced RSA and AES Cryptographic Provider" -NotAfter $notAfter).Thumbprint
$pwd = ConvertTo-SecureString -String $pwd -Force -AsPlainText
@caomai
caomai / string_unindent_for_heredoc.rb
Created August 29, 2011 16:53
Extend String class with unindent method to tidy HEREDOC
## Credit to SpiralOfHope for bugfix
### https://twitter.com/#!/spiralofhope
## Credit to Rene Sarsoo for original code
### http://stackoverflow.com/users/15982/rene-saarsoo
### http://stackoverflow.com/questions/3772864/how-do-i-remove-leading-whitespace-chars-from-ruby-heredoc/4465640#4465640
class String
# Bug-fixed: If there is no indenting, this explodes. I changed \s+ to \s*
@ashbb
ashbb / green_shoes_participants.rb
Created August 26, 2011 13:35
Participant's countries of Ruby with Shoes course 8th batch at RubyLearning.org
require 'green_shoes'
require 'mechanize'
begin
require 'hpricot'
rescue LoadError
require File.join(Shoes::DIR, 'ext/hpricot')
end
include Hpricot
#! /bin/bash
(($#)) || (echo "Usage: mack PATTERN PATTERN [PATTERN...]"; exit 1)
if (($# == 1)); then
ack -l "$1"
else
grep -Ffx <(ack -l "$1") <(shift; mack "$@")
fi