Skip to content

Instantly share code, notes, and snippets.

View gitfvb's full-sized avatar
👋

Florian von Bracht gitfvb

👋
View GitHub Profile
@gitfvb
gitfvb / backup.ps1
Created February 6, 2020 09:14
Daily backup and cleanup for folders in PowerShell
################################################
#
# SETTINGS
#
################################################
$foldersToBackup = @(
"D:\Apteco\Publish\holidays\private"
"D:\Apteco\Publish\holidays\public"
area["name"="Aachen"][boundary=administrative]->.myarea;
rel(area.myarea)["boundary"="postal_code"];
out geom;
@gitfvb
gitfvb / loop_inserts.sql
Last active December 9, 2019 12:02
Outline to page through MSSQL inserts (especially helpful for big joins)
/* Drop temporary table if exists */
DROP TABLE IF EXISTS #CommTestefd5adf666914ec88906066cdcf4de1f
/* Create a temporary table */
CREATE TABLE #CommTestefd5adf666914ec88906066cdcf4de1f
(
[Id] [int] NOT NULL,
[Urn] [sql_variant] NULL,
[StepId] [int] NULL,
[StateId] [int] NULL,
@gitfvb
gitfvb / jwt.ps1
Created November 1, 2019 16:28
create a standard jwt token in PowerShell
<#
based on this example from: https://jwt.io/
https://stackoverflow.com/questions/30246497/using-statement-for-base64urlencode
https://medium.com/@nikitafed9292/net-base64-decoding-workaround-82b797162b6e
https://blog.angular-university.io/angular-jwt/
https://gist.github.com/kucukkanat/1ef77db8120323db2b89087735ef8a5d
#>
################################################
@gitfvb
gitfvb / base64.ps1
Created November 1, 2019 10:31
Base64 String converting in PowerShell because some frameworks trim the "=" at the end
# source of functions: https://medium.com/@nikitafed9292/net-base64-decoding-workaround-82b797162b6e
# Add missing "=" at the end
Function Check-Base64 {
param(
[Parameter(Mandatory=$true)][String]$inputString
)
$input
@gitfvb
gitfvb / read_wsdl.ps1
Last active October 29, 2019 09:47
first try to read and parse SOAP wsdl in powershell
$wsdlUrl = "https://soap.flexmail.eu/3.0.0/flexmail.wsdl"
$wsdlContent = Invoke-RestMethod -Method Get -Uri $wsdlUrl -Verbose
# metadata
$targetNamespace = $wsdlContent.definitions.targetNamespace
$bindingStyle = $wsdlContent.definitions.binding.binding.style
# operations (different ways)
$operations1 = $wsdlContent.definitions.binding.operation
@gitfvb
gitfvb / unix-timestamp.ps1
Created October 21, 2019 13:47
PowerShell function to create a unixtimestamp (seconds or milliseconds since 1970)
Function Get-Unixtime {
param(
[Parameter(Mandatory=$false)][switch] $inMilliseconds = $false
)
$multiplier = 1
if ( $inMilliseconds ) {
$multiplier = 1000
@gitfvb
gitfvb / 00__create_settings.ps1
Last active October 18, 2019 20:24
encrypt and decrypt parts of xml via powershell
################################################
#
# SCRIPT ROOT
#
################################################
# Load scriptpath
if ($MyInvocation.MyCommand.CommandType -eq "ExternalScript") {
$scriptPath = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
@gitfvb
gitfvb / 00__create_settings.ps1
Last active October 18, 2019 09:42
Check EpiServer output before uploading
################################################
#
# SCRIPT ROOT
#
################################################
# Load scriptpath
if ($MyInvocation.MyCommand.CommandType -eq "ExternalScript") {
$scriptPath = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
@gitfvb
gitfvb / create_settings.ps1
Last active October 17, 2019 11:07
PowerShell Snippets Collection
################################################
#
# SCRIPT ROOT
#
################################################
# Load scriptpath
if ($MyInvocation.MyCommand.CommandType -eq "ExternalScript") {
$scriptPath = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition