Skip to content

Instantly share code, notes, and snippets.

View lboening's full-sized avatar

Luke Boening lboening

View GitHub Profile
@jschpp
jschpp / Export-PowerShellDataFile.psm1
Last active December 29, 2022 18:19
Exports a powershell object to a psd1 format. Can be re-imported via Import-PowershellDataFile
function Get-IdentedString {
<#
.SYNOPSIS
Returns $obj as indented string
.DESCRIPTION
Turns $obj to string and adds $indent * 4 spaces in front of it
.PARAMETER obj
Object to be converted to String
ruby -e "open(`gem which rubygems`.sub(/\.rb\s*\z/, '/ssl_certs/GlobalSignRootCA.pem'), 'wb').write %(-----BEGIN CERTIFICATE-----\nMIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkG\nA1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv\nb3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAw\nMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i\nYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJHbG9iYWxT\naWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaDuaZ\njc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp\nxy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp\n1Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG\nsnUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ\nU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8\n9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E\nBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0B\nAQUFAAOCAQEA1nPnfE920I2/7LqivjTFKDK
@adeekshith
adeekshith / .git-commit-template.txt
Last active February 21, 2024 12:06 — forked from Linell/.git-commit-template.txt
This commit message template helps you write great commit messages and enforce it across teams.
# <type>: (If applied, this commit will...) <subject> (Max 50 char)
# |<---- Using a Maximum Of 50 Characters ---->|
# Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# Provide links or keys to any relevant tickets, articles or other resources
# Example: Github issue #23
@ctigeek
ctigeek / PowershellAes.ps1
Last active March 25, 2024 23:16
Aes Encryption using powershell.
function Create-AesManagedObject($key, $IV) {
$aesManaged = New-Object "System.Security.Cryptography.AesManaged"
$aesManaged.Mode = [System.Security.Cryptography.CipherMode]::CBC
$aesManaged.Padding = [System.Security.Cryptography.PaddingMode]::Zeros
$aesManaged.BlockSize = 128
$aesManaged.KeySize = 256
if ($IV) {
if ($IV.getType().Name -eq "String") {
$aesManaged.IV = [System.Convert]::FromBase64String($IV)
}
@altrive
altrive / PowerShellv5_UsingNamespace.ps1
Last active November 12, 2019 16:11
PowerShell v5 'using namespace' syntax test
#Require -Version 5.0
# using statement must appear before any other statements in a script.
# other using types(Assembly/Command/Module/Type) is not supported yet?
# [Enum]::GetNames('System.Management.Automation.Language.UsingStatementKind')
using namespace System.Diagnostics
using namespace System.Linq
function Main
{
@jokecamp
jokecamp / gist:2c1a67b8f277797ecdb3
Last active January 31, 2024 01:48
Powershell HMAC SHA 256 Example
# Powershell HMAC SHA 256
$message = 'Message'
$secret = 'secret'
$hmacsha = New-Object System.Security.Cryptography.HMACSHA256
$hmacsha.key = [Text.Encoding]::ASCII.GetBytes($secret)
$signature = $hmacsha.ComputeHash([Text.Encoding]::ASCII.GetBytes($message))
$signature = [Convert]::ToBase64String($signature)
// Restify Server CheatSheet.
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
var restify = require('restify');
@serbrech
serbrech / MsDeploy.ps1
Created December 17, 2013 11:57
Powershell wrapper around msdeploy.exe
function DeployWebsite($Package, $Server, $IISSite, $App, $Username, $Password) {
$MSDeployKey = 'HKLM:\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\3'
if(!(Test-Path $MSDeployKey)) {
throw "Could not find MSDeploy. Use Web Platform Installer to install the 'Web Deployment Tool' and re-run this command"
}
$InstallPath = (Get-ItemProperty $MSDeployKey).InstallPath
if(!$InstallPath -or !(Test-Path $InstallPath)) {
throw "Could not find MSDeploy. Use Web Platform Installer to install the 'Web Deployment Tool' and re-run this command"
}
@oodavid
oodavid / README.md
Last active June 12, 2024 00:28 — forked from aronwoost/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
# goes in $HOME\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
function rmrf {
rm -Recurse -Force $Args
}
function clone_vimfiles {
Set-Location $HOME
rmrf _gvimrc
rmrf _vimrc