Skip to content

Instantly share code, notes, and snippets.

Avatar

Dindo Liboon dindoliboon

  • NCCU ITS
View GitHub Profile
@dindoliboon
dindoliboon / aes_example.ps1
Last active Aug 12, 2020
Encrypt and decrypt with PowerShell
View aes_example.ps1
function Get-PlaintextFromSecureString([SecureString]$SecureString) {
return (New-Object -TypeName System.Net.NetworkCredential('fake-user', $SecureString, 'fake-domain')).Password
}
function EncryptStringToBytes([String]$Plaintext, [System.Security.SecureString]$Password) {
# C# code from:
# https://gist.github.com/mark-adams/87aa34da3a5ed48ed0c7
# https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.aes?view=netframework-4.8
$Aes = $null
@dindoliboon
dindoliboon / BcxDevCmd.bat
Created Mar 23, 2020
Set BCX development environment
View BcxDevCmd.bat
@ECHO OFF
SET BCX_ROOT=C:\Program Files (x86)\BCX
SET PATH=%PATH%;C:\Program Files (x86)\BCX\Bin;C:\Program Files\PellesC\Bin
ECHO BCXCON - Compile console applications
ECHO BCXDLL - Compile dynamic libraries
ECHO BCXGUI - Compile GUI applications
@dindoliboon
dindoliboon / Jwt-CreateToken.ps1
Last active Jul 27, 2020
System.IdentityModel.Tokens.Jwt with PowerShell to create JWT using RS256
View Jwt-CreateToken.ps1
<#
System.IdentityModel.Tokens.Jwt with PowerShell to create JWT using RS256.
http://blog.d-apps.com/2013/08/powershell-and-json-web-token-handler.html
Tested using:
Windows 10.0.18362.628
PowerShell 7.0.0
Windows PowerShell 5.1.18362.628
NuGet 5.4.0.6315
System.IdentityModel.Tokens.Jwt 5.6.0
@dindoliboon
dindoliboon / libMaxMindGeoIp2V1.psm1
Last active Mar 18, 2020
PowerShell library for performing geo IP lookups.
View libMaxMindGeoIp2V1.psm1
<#
PowerShell library for performing geo IP lookups.
Requirements:
- PowerShell 7.0.0 or Windows PowerShell 5.1.18362.628
https://github.com/PowerShell/PowerShell/releases
- nuget 5.4.0.6315
Invoke-WebRequest -Uri 'https://dist.nuget.org/win-x86-commandline/latest/nuget.exe' -OutFile (Join-Path -Path ([Environment]::GetFolderPath('UserProfile')) -ChildPath 'Downloads\nuget.exe')
@dindoliboon
dindoliboon / libGoogleAdminDirectoryV1.psm1
Created Apr 3, 2018
Windows PowerShell library for performing basic requests on Google Apps User resources.
View libGoogleAdminDirectoryV1.psm1
<#
Windows PowerShell library for performing basic requests on Google Apps User resources.
These are general steps and may not follow the Google Dashboard step-by-step.
Requirements:
- .NET Framework 4.5
https://www.microsoft.com/net/download/dotnet-framework-runtime
- .NET Core SDK 2.1.101
@dindoliboon
dindoliboon / AadSyncStatusConsole-thumbnail.png
Last active Jan 3, 2018
Poll Azure AD Connect for the current sync status and initiate a delta sync cycle.
@dindoliboon
dindoliboon / shibidp-deploy.ps1
Last active Aug 11, 2020
Deploy basic install of Shibboleth IdP on Windows Server 2019.
View shibidp-deploy.ps1
#
# Moved code to shibidp-deploy.psm1.
#
# Must call function now, but this allows customization using parameters.
#
# Perform default install.
# iex (iwr 'https://gist.githubusercontent.com/dindoliboon/553884cfc67cc2672a786e4aee69cd63/raw/shibidp-deploy.ps1').Content
#
# Example on customizing non-HTTPS port and Java heap size.
# iex (iwr 'https://gist.githubusercontent.com/dindoliboon/553884cfc67cc2672a786e4aee69cd63/raw/shibidp-deploy.psm1').Content; Install-App -JettyNonHttpsPort 8081 -JavaMinimumHeapSize '4g' -JavaMaximumHeapSize '4g'
@dindoliboon
dindoliboon / Set-PropertyValue.ps1
Created Jun 20, 2017
Updates simple property files.
View Set-PropertyValue.ps1
function Set-PropertyValue
{
[CmdletBinding()]
param($Path, $Key, $Value, $Separator='=', $Comment="# ", $Backup=$true)
$ini = Get-Content -Path $Path
$newIniPath = [System.IO.Path]::GetTempFileName()
$found = $false
$ini.Split("`n") |% {
@dindoliboon
dindoliboon / Get-WebFile.ps1
Last active May 13, 2019
Download files in Nano Server.
View Get-WebFile.ps1
<#
.DESCRIPTION
Downloads a file from the specified website.
.EXAMPLE
Downloads Jetty 9.3.20.
Get-WebFile -Uri 'http://central.maven.org/maven2/org/eclipse/jetty/jetty-distribution/9.3.20.v20170531/jetty-distribution-9.3.20.v20170531.zip' -OutFile 'C:\jetty-distribution-9.3.20.v20170531.zip'
.EXAMPLE
Downloads Oracle Server JRE 8u131 and verifies hash.
Get-WebFile -Uri 'http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/server-jre-8u131-windows-x64.tar.gz' -OutFile 'C:\server-jre-8u131-windows-x64.tar.gz' -Cookie 'oraclelicense=accept-securebackup-cookie;' -Hash '1806EBE235EAB2B21C893ACBF0B287A392CE6B5EDFEA3286FC8FF7D6DEFB19CB'
.OUTPUTS
@dindoliboon
dindoliboon / OracleFormsJnlpGenerator.ps1
Created May 6, 2016
Generates JNLP file from an Oracle Forms application to use locally or on a web server. Allows Oracle Forms application to run without a web browser.
View OracleFormsJnlpGenerator.ps1
<#
Generates JNLP file from an Oracle Forms application.
Tested against an Oracle Forms 11g server.
Information from:
Jan Carlin's Blog - Forms and Java Web Start
https://web.archive.org/web/20081201161421/http://groundside.com/blog/JanCarlin.php
#>
You can’t perform that action at this time.