Skip to content

Instantly share code, notes, and snippets.

@TiloGit
TiloGit / mini-web.ps1
Created January 3, 2024 20:41
powershell mini webserver (to serve txt tile for HTTP validation for example)
View mini-web.ps1
$basePath='C:\mini-webserver\'
mkdir -p "$basePath/web/.well-known/pki-validation/"
##paste the txt file to this location
$http = [System.Net.HttpListener]::new()
# Hostname and port to listen on
##port 80 requires admin PS
$http.Prefixes.Add("http://+:80/")
# Start the Http Server
$http.Start()
@TiloGit
TiloGit / fn-acce-icc4sap-props.js
Last active September 13, 2023 01:19
FileNet ACCE batch Action to create SAP properties (ICC4SAP)
View fn-acce-icc4sap-props.js
//paste in ACCE bulk operation (select only one item)
importClass(java.lang.System);
function OnCustomProcess(CEObject) {
var objStore = CEObject.getObjectStore();
objStore.refresh();
var sapprops = [
{ title: "ALFdpages", desc:"The total number of ALF description pages, if the document is paginated.", max: 3},
{ title: "ALFpages", desc:"The total number of ALF pages, if the document is paginated.", max: 3},
View read-azure-app-perm.ps1
##based on https://github.com/12Knocksinna/Office365itpros/blob/master/ReportPermissionsApps.PS1
#
# ReportPermissionsApps.PS1
# A script using Azure Automation and a managed identity to scan for apps assigned high-priority permissions and report them
# for administrator review
##install graph PS
Install-Module Microsoft.Graph -Scope CurrentUser
#Connect-AzAccount -Identity
@TiloGit
TiloGit / petool.sh
Last active December 23, 2022 19:54
FN PE tools vwlog vwtool pelog in container
View petool.sh
#PE Tools on container
# 1. Downlaod IBM FileNet Process Engine >> PE Java API from ACCE
# 2. also CE for jace.jar
#create jre or jdk pod
kind: Pod
apiVersion: v1
metadata:
name: tilo-jdk-pod
@TiloGit
TiloGit / shaw-compress.sh
Created December 3, 2022 00:19
compress and rename shaw PDFs
View shaw-compress.sh
##for PDF invoices with filename like ShawInvoice_01412345678_01Apr2022.pdf
for file in Shaw*.pdf
do
echo "$(date +"%F_%s") Start $file"
filedate=$(basename "$file" .pdf | tail -c 10)
outFdate=$(date -d $filedate +"%F")
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dPDFSETTINGS=/ebook -sOutputFile=${outFdate}_${file} $file
echo "$(date +"%F_%s") Done $file"
done
@TiloGit
TiloGit / GenPDFfiles-PDFsharp.ps1
Last active October 3, 2022 22:03
Generate PDF files from Powershell text with dummy filler file (with PDF sharp DLL)
View GenPDFfiles-PDFsharp.ps1
## the PDF
$ExecuteStarTime = get-date
Add-Type -Path .\PdfSharp.dll #### got PdfSharp.dll from ngut download https://www.nuget.org/packages/PdfSharp/ (open with 7zip)
$img = [PdfSharp.Drawing.XImage]::FromFile("C:\test-trex-fs-root\TILOPDF\TSOsou\dummy.png")
##now loop
10001..10500 | % {
$doc = New-Object PdfSharp.Pdf.PdfDocument
$doc.Info.Title = "Content File $($_)"
$doc.Info.Author = "$($env:username)"
$doc.Info.Subject = "This is Test Content File"
@TiloGit
TiloGit / GenPDFfiles.ps1
Created October 3, 2022 20:19
Generate PDF files from text in powershell
View GenPDFfiles.ps1
#################createPrinter
# choose a name for your new printer
$printerName = 'PrintPDFUnattended'
# choose a default path where the PDF is saved
$PDFFilePath = "C:\PrinterTemp\PDFResultFile.pdf"
New-Item $PDFFilePath -type file -Force
# add printerPort
Add-PrinterPort -Name $PDFFilePath
# add printer
Add-Printer -DriverName "Microsoft Print to PDF" -Name $printerName -PortName $PDFFilePath
@TiloGit
TiloGit / icn-curl-example.sh
Last active July 6, 2022 18:49
ICN (navigator) curl example with CP4BA IAM and ZEN (CPD)
View icn-curl-example.sh
iamURL="cp-console.apps.ocp6.tsodev.com"
cpdURL="cpd-alf1.apps.ocp6.tsodev.com"
userid="cp4baadmin"
userpw="mypass123"
##now in chain
iamToken=$(curl -b icncookie.txt -c icncookie.txt -k -s -X POST -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" -d "grant_type=password&username=$userid&password=$userpw&scope=openid" https://$iamURL/idprovider/v1/auth/identitytoken | jq '.access_token' | xargs)
echo $iamToken
@TiloGit
TiloGit / check-res.sh
Created June 17, 2022 21:20
Check HTTP reponse time via curl
View check-res.sh
#!/bin/bash
##from https://ops.tips/gists/measuring-http-response-times-curl/
##mod by allow self sign cert (-k)
# Set the `errexit` option to make sure that
# if one command fails, all the script execution
# will also fail (see `man bash` for more
# information on the options that you can set).
set -o errexit
@TiloGit
TiloGit / get-fn-addon-viajs.js
Created May 5, 2022 22:16
FileNet GCD Addon list (quick hack)
View get-fn-addon-viajs.js
importClass(java.lang.System);
function OnCustomProcess (CEObject)
{
var objStor = CEObject.getObjectStore();
objStor.refresh();
var myDomain = objStor.get_Domain();
myDomain.refresh();
var AddOnListIterator = myDomain.get_AddOns().iterator();
var output = "";