Skip to content

Instantly share code, notes, and snippets.

@TiloGit
TiloGit / cmis_create_folder_file.ps1
Last active October 8, 2025 06:18
Simple CMIS test. create folder and create document
#### create Folder
# Generate timestamp
$myDate = get-date -uformat "%Y-%m-%d_%s"
$folderName = "tilo_folder_$myDate"
# Define URL and credentials
$url = "http://99.99.97.146:8077/cmis/browser/Y8/root"
$pair = "admin:mypass"
$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
$basicAuthValue = "Basic $encodedCreds"
@TiloGit
TiloGit / log4j2.xml
Created September 23, 2025 22:18
debug Apache CMIS chemistry-opencmis-workbench log4j2 config
<Configuration status="info" packages="org.apache.chemistry.opencmis.workbench">
<Appenders>
<ClientWriterAppender name="logframe">
<PatternLayout pattern="> %d{HH:mm:ss} %5.5p %40.40c: %m%n%throwable{50}" />
</ClientWriterAppender>
<!-- Console appender -->
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c - %m%n"/>
</Console>
</Appenders>
@TiloGit
TiloGit / example.sh
Created July 17, 2025 23:03 — forked from soheilpro/example.sh
Easy IIS log file format specification for goaccess.
goaccess -f u_ex150629.log --log-format "$(cat u_ex150629.log | ./goiisformat.sh)" --date-format '%Y-%m-%d' --time-format '%H:%M:%S'
@TiloGit
TiloGit / container-max-temp-test.sh
Created June 4, 2025 17:44
Test tmp file size for container (docker or kubernetes)
### test on k8s
#kubectl run tilotmptest --image=registry.access.redhat.com/ubi8/openjdk-8-runtime --wait --restart=Never --command dd if=/dev/zero of=/tmp/testfile bs=500k count=1024
#kubectl logs tilotmptest && kubectl delete pod tilotmptest
# 1 GB
kubectl run tilotmptest --image=registry.access.redhat.com/ubi8/openjdk-8-runtime --attach --rm --restart=Never --command dd if=/dev/zero of=/tmp/testfile bs=1000k count=1024
# 5 GB
kubectl run tilotmptest --image=registry.access.redhat.com/ubi8/openjdk-8-runtime --attach --rm --restart=Never --command dd if=/dev/zero of=/tmp/testfile bs=5000k count=1024
##test on docker
#100MB
@TiloGit
TiloGit / s3-upload-test.sh
Last active May 23, 2025 17:25
AWS S3 cURL example with (AWS Signature Version 4) for Google Cloud (GCP) and IBM Cloud Contnet Object Storage COS
## IBM Cloud Test upload curl style
# make sure your endpoint is align with your S3 bucket otherwise you get "The specified bucket does not exist"
# seems that IBM want AWS Sign V4 (AWS Signature Version 4)
# curl feature --aws-sigv4 (requires newer curl like 8.x) consider using container if your local curl is not new enough
# docker run -ti curlimages/curl sh
date=`date +%Fat%s`
fileName="test-tilo-${date}.txt"
echo "test tilo here at $date" > $fileName
s3Bucket="my-icos-bucket-mon01"
@TiloGit
TiloGit / az-create-budget-alert.sh
Created May 8, 2025 22:23
AZ Create budget alert for few subscriptions.
subs=(
52zzzzzzzzzzzzzzzzzzzzzzzzzzzzz9b6dd
a2zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz480d
1azzzzzzzzzzzzzzzzzzzzzzzzzzzzzz9a1e
)
##now run
for sub in ${subs[@]}
do
echo "$(date -Is) Now work on $sub"
@TiloGit
TiloGit / XMLconvert.ps1
Created January 23, 2025 23:39
Convert IBM FileNet GCD XML file to readable and compareable html
### Call like this.
### .\XMLconvert.ps1 <<Folder with XML to convert>> <<your-template.xsl>> << output folder >>
### .\XMLconvert.ps1 C:\temp\test-pretty-print C:\temp\test-pretty-print\gcd-prettyprint-template.xsl C:\temp\test-pretty-print\out
param ($xml, $xsl, $output)
if (-not $xml -or -not $xsl -or -not $output)
{
Write-Host "& .\xslt.ps1 [-xml-folder] xml-input-folder [-xsl] xsl-input [-output-folder] transform-output-folder"
exit;
@TiloGit
TiloGit / copy-box-template.sh
Created January 21, 2025 19:22
copy box metadata template from one to another box account
#########################
##login to source box account
boxaccesstoken=$(python /mnt/c/myscripts/box-admin-scripts/box-login-read-json-dynamic.py --jsonpath /mnt/c/myscripts/box-admin-scripts/box-demo-old.json)
##read and copy metadata template to other box account
myTemplateName="purchaseRequisition"
##get source metadata def.
sourceJson=$(curl -s -X GET "https://api.box.com/2.0/metadata_templates/enterprise/$myTemplateName/schema" \
-H "Authorization: Bearer $boxaccesstoken")
@TiloGit
TiloGit / read-ibm-filenet-gcd-from-db.ps1
Last active January 23, 2025 23:40
Read IBM FileNet GCD from Database as XML script
$SQLServer = "mysqlserver1232.westus2.cloudapp.azure.com"
$SQLDBName = "ABC_FNGCD"
$uid ="sa"
$pwd = "my-db-pass123"
##modify below query if you want specific GCD version
$SqlQuery = "select gcd_blob FROM FNGCD WHERE epoch_id = (select last_epoch_id from FNGCD where epoch_id = 0);"
$SqlConnection = New-Object System.Data.SqlClient.SqlConnection
$SqlConnection.ConnectionString = "Server = $SQLServer; Database = $SQLDBName; User ID = $uid; Password = $pwd;"
$SqlCmd = New-Object System.Data.SqlClient.SqlCommand
@TiloGit
TiloGit / ps-direct-task.ps1
Created May 3, 2024 17:24
win task scheduler powershell direct command (no script)
##some examples how to run PS direct command in win task scheduler
##run in admin shell
##simple style
$Trigger = New-ScheduledTaskTrigger -Daily -At "10:15pm" # Specify the trigger settings
$User = "NT AUTHORITY\SYSTEM" # Specify the account to run the script
$Action = New-ScheduledTaskAction -Execute "PowerShell.exe" -Argument '-Command Get-ChildItem C:\myapp\config\tmp -Recurse | Where LastWriteTime -lt (Get-Date).AddDays(-2) | Remove-Item -Recurse -Force 2>&1 > C:\myapp\logs\ps-script-out.log' # Specify what program to run and with its parameters