Instantly share code, notes, and snippets.

View urlencode.ps1
[uri]::EscapeDataString("bla bla")
View date.ps1
[datetime]::UtcNow.ToString("o")
[datetime]::UtcNow.ToString("yyyyMMddHHmmss")
View create_settings.ps1
################################################
#
# SCRIPT ROOT
#
################################################
# script root path
if ($MyInvocation.MyCommand.CommandType -eq "ExternalScript")
{ $scriptPath = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition }
View file_dialogue.ps1
Add-Type -AssemblyName System.Windows.Forms
Function Get-FileName($initialDirectory, $filter)
{
$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
$OpenFileDialog.initialDirectory = $initialDirectory
$OpenFileDialog.filter = $filter
$OpenFileDialog.ShowDialog() | Out-Null
$OpenFileDialog.filename
View request_emarsys_api.ps1
# change this for the emarsys request
$username = "username001"
$secret = "secret"
$url = "https://trunk-int.s.emarsys.com/api/v2/field/translate/de"
#$url = "https://trunk-int.s.emarsys.com/api/v2/settings"
View merge_csv_files.ps1
################################################
#
# PREPARATION / ASSEMBLIES
#
################################################
# Load scriptpath
if ($MyInvocation.MyCommand.CommandType -eq "ExternalScript") {
$scriptPath = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
View readme.md

First

  • Install the app "Sports DV" and change WiFi SSID and password

URLs

  • Wifi and Cam settings are seperated and have different port numbers.
  • Wifi-Settings (just login withoug username and password): http://192.168.25.1
  • Cam LiveStream: http://192.168.25.1:8080/?action=stream
  • Not sure how the configuration is made really... Would need a Man-In-The-Middle-Attack or send the initial ICMP package

Change AP (Cam is the access point) to Station (Cam is a normal WiFi Client)

View regex.ps1
# the task is to match everything between SELECT and FROM
$string = "SELECT abc FROM def"
$pattern = '(?<=SELECT\s)(.*)(?=\sFROM)'
# search for pattern and output it
$string | Select-String $pattern -AllMatches | % {$_.Matches}| % {$_.Value}
# replace the match with something else
$string -replace $pattern, 'xyz'
View replace.ps1
# with parsing of csv
$inputfile = "Datentabelle 3.txt"
$outputfile = "export.csv"
$inputdelim = "`t"
$outputdelim = ','
$inputenc = "UTF8"
$outputenc = "UTF8"
rm $outputfile
View press_enter.ps1
$NULL = Read-Host "Press enter to exit"