Skip to content

Instantly share code, notes, and snippets.

View mu88's full-sized avatar

Mirko 🇪🇺 🇺🇦 mu88

View GitHub Profile
@mu88
mu88 / Dockerfile
Last active December 7, 2019 11:28
Docker and dotTrace - Dockerfile
FROM mcr.microsoft.com/windows/servercore:1903
COPY bin/Release/netcoreapp3.0/win-x64/* ./
ENTRYPOINT ["TestWithDocker.exe"]
@mu88
mu88 / CustomTranslator.cs
Last active September 28, 2023 11:52
i18n and l10n of server-side Blazor
public class CustomTranslator : ICustomTranslator
{
public CustomTranslator(IStringLocalizer<CustomTranslator> localizer)
{
Localizer = localizer;
}
public string GetTranslation(string text)
{
return Localizer[text];
@mu88
mu88 / CreateDatabase.sql
Created October 11, 2019 13:54
Creates a new SQL Server database with a new user being db_owner
DECLARE @MyDatabase nvarchar(MAX);
DECLARE @MyLogin nvarchar(MAX);
DECLARE @MyPassword nvarchar(MAX);
DECLARE @SQL nvarchar(MAX);
SET @MyDatabase = 'TheDatabase';
SET @MyLogin = 'TheLoginAndUserName';
SET @MyPassword = 'TopSecret';
IF NOT EXISTS
@mu88
mu88 / TidyUpTeamCityBuilds.ps1
Created April 12, 2019 14:27
Pins and deletes old builds on TeamCity
Clear-Host
$ErrorActionPreference = 'Stop'
$BasicSecret = "MySecretBeingABase64StringContainingUsernameAndPasswordSeparatedByColon"
$TeamCityHost = "http://myTeamCityHost:1234"
$TeamCityBaseUrl = $TeamCityHost + "/httpAuth/app/rest/"
$JsonHeader = @{
"Authorization" = "Basic $BasicSecret"
"Accept" = 'application/json'
}
@mu88
mu88 / Configure.ps1
Last active June 4, 2018 14:04
IIS - Create folders, application pools and websites according to a very specific pattern
Clear-Host
Import-Module WebAdministration
$definitionFile = "C:\temp\IIS_Definition.json"
# import JSON definition file
$definitions = Get-Content -Raw -Path $definitionFile | ConvertFrom-Json
$baseDirectory = $definitions.baseDirectory
@mu88
mu88 / post-receive
Created March 1, 2018 16:34
Git - Notify Jenkins (Post Commit Hook)
#!/bin/bash
echo Notifying Jenkins Server
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
echo "== $branch =="
curl -s "https://myJenkins.com/git/notifyCommit?url=https://myGitServer.com/MyGitRepository.git&branches=$branch"
done
@mu88
mu88 / ListRaster.py
Created March 1, 2018 16:28
ArcPy - List all Rasters within File Geodatabase
import arcpy, codecs, csv, os, shutil
os.system("cls")
origFgdbLocation = r"\\Server\Share"
origFgdbNames = ["MyFileGeodatabase1", "MyFileGeodatabase2", "MyFileGeodatabase3"]
csvFilePath = r"C:\temp\members.csv"
elements = []
for fgdbName in origFgdbNames:
@mu88
mu88 / CloneAndTransformFGDB.py
Created March 1, 2018 16:27
ArcPy - Create an empty clone of a File Geodatabase (with all Feature Classes and Tables) and set a new Coordinate Reference System
import arcpy, os, shutil
os.system("cls")
origFgdbLocation = r"\\Server\Share"
origFgdbNames = ["myFileGeodatabase"] # DON'T append the suffix ".gdb"
newFgdbLocation = r"\\OtherServer\OtherShare"
resolution = "0.00005 Meters"
tolerance = "0.0001 Meters"
newCrs = arcpy.SpatialReference(2056) # EPSG code of "CH1903+ LV95"
@mu88
mu88 / Compare.py
Created March 1, 2018 16:19
ArcPy - Compare two File Geodatabases
import arcpy, logging, math, os, shutil, sys
def GetCharDigitSum(s):
if s is None:
return 0
sum = 0
for c in s:
sum = sum + ord(c)
@mu88
mu88 / CreateGisServerConnectionFiles.py
Created March 1, 2018 16:16
ArcPy - Create ArcGIS Server Connection File
import arcpy
servers = ['myServer1', 'myServer2', 'myServer3']
outdir = 'GIS Servers' # using 'GIS Servers' results in creating the AGS files in the 'GIS Servers' section of ArcCatalog (equivalent to '%appdata%\ESRI\Desktop10.5\ArcCatalog')
username = ''
password = ''
for server in servers:
out_name = server + ' (admin).ags'
server_url = 'https://' + server + '/arcgis/admin'