Instantly share code, notes, and snippets.

View bing_batch_geocode.ps1
################################################
#
# SETTINGS
#
################################################
# settings for the API
$bingMapskey = "<yourbingmapskey>"
# file should be in UTF8
View joblist_bing.ps1
$jobs = Invoke-RestMethod -Uri "http://spatial.virtualearth.net/REST/v1/dataflows/listjobs?key=<yourbingmapskey>&output=json" -Method Get # -ProxyUseDefaultCredentials $true # -Proxy "http://proxy:8080" -ProxyCredential $cred
$jobs.resourceSets.resources | select id -expand links
View hash.ps1
Function Get-StringHash()
{
param(
[Parameter(Mandatory=$true)][string]$inputString,
[Parameter(Mandatory=$true)][string]$hashName,
[Parameter(Mandatory=$false)][string]$salt,
[Parameter(Mandatory=$false)][boolean]$uppercase=$false
)
$string = $inputString + $salt
View list_temp_folders.ps1
################################################
#
# PREPARATION / ASSEMBLIES
#
################################################
# Load scriptpath
if ($MyInvocation.MyCommand.CommandType -eq "ExternalScript") {
$scriptPath = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
} else {
View save_password.ps1
################################################
#
# PREPARATION / ASSEMBLIES
#
################################################
# Load scriptpath
if ($MyInvocation.MyCommand.CommandType -eq "ExternalScript") {
$scriptPath = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
} else {
View explore.ps1
# check some rows in between
cd "<path>"
$file = Get-Item -path "filename.csv"
$readFirstLine = $true
$startLine = 121200
$endLine = 121400
View example.csv
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file
CustId Straße PLZ Ort
123 D-Str. 5 52080 Aachen
456 Am Keller 2 61080 Bad Vilbel
789 Kaiserstraße 35 60329 Frankfurt am Main
View rewrite_files.ps1
function rewriteFile() {
param(
[Parameter(Mandatory=$true)][string]$inputPath,
[Parameter(Mandatory=$true)][int]$inputEncoding,
[Parameter(Mandatory=$true)][string]$outputPath,
[Parameter(Mandatory=$true)][int]$outputEncoding,
[Parameter(Mandatory=$false)][int]$skipFirstLines
View install_orbit_manually.ps1
<#
download nuget cli tool
https://www.nuget.org/downloads
#>
# add orbit source repository for nuget
.\nuget.exe sources add -name "Apteco Orbit" -Source "https://orbit.apteco.com/FastStatsOrbitUpdateServer/nuget"
View urlencode.ps1
[uri]::EscapeDataString("bla bla")