Skip to content

Instantly share code, notes, and snippets.

milolav /
Created Mar 8, 2021
Oauth2 certificate authentication in bash for Microsoft Graph and Google APIs
set -e
subject_email='' #user that will be impersonated
key_file='my.key' #certificate private key (for signing)
ts=$(date +%s)
milolav / self-signed-cert.cmd
Created Apr 13, 2020
Quickly create self signed certificates with one or more domain names using openssl on windows
View self-signed-cert.cmd
@echo off
if [%1]==[] (
echo Usage: %0 ^<domain_name^> [additional_domain] [additional_domain] ...
exit /b 1
set friendly=%1
if [%2]==[] (set addsan=) else (set addsan=1)
milolav /
Created Apr 9, 2020
Simple script to create certificates for Docker daemon http socket. Certificates will be created in /etc/docker/certs dir, and /lib/systemd/system/docker.service will be edited to enable secure socket
set -e
## Script to create certificates required for secure communication over https
SUFFIX=`sed -n 's/^search \([^ ]*\).*/\1/p' /etc/resolv.conf`
if [ $HOST ]; then
View Prepare-VirtualWinVhd.ps1
# Copyright (c) milolav
# MIT License
param (
[string]$WinEdition = "Windows 10 Enterprise",
[long]$VhdSize = 40GB,
[char]$EfiLetter = 'R',
[char]$VirtualWinLetter = 'W',
milolav / OwaGalExtractor.js
Last active Jan 12, 2020
Download Global Address List (GAL) entries as .vcf files from browser. With photos too. Can be used with Puppeteer (headless Chrome) to integrate with other systems. Doesn’t require any administrative privileges. Log in to paste into console window and run one of the functions at the bottom.
View OwaGalExtractor.js
Copyright (c) 2019-2020 milolav
Released under the MIT License
; (function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
global.OwaGalExtractor = factory()
}(this, (function () {
milolav / Update-DynReleaseCalendar.ps1
Created Jun 6, 2019
PowerShell script to track Service Updates for Microsoft Dynamics 365 CE published through Office 365 Service Communications as appointments in D365 (and sync them with Exchange server if sync is enabled)
View Update-DynReleaseCalendar.ps1
# With Microsoft pushing "Service Update XX" almost every week it became hard
# to track down when particular update is going to be released.
# This script uses application registered in AAD with privileges to read
# messages from Office 365 Communication API and access D365 to create
# appointments. Appointments are set category and subcategory to identify
# unique messages without customizations. Recipients of the appointment are
# defined as a list of activity parties.
milolav / pre-commit
Last active May 14, 2019
I was trying to figure out how to have autoincrement for c# projects that will work in the background, that works locally and that will not change on every build allowing you to build an app with the version stored in source control. And the result is this pre-commit script. It’s not perfect but it works for me. To use, put the file into .git\ho…
View pre-commit
# Update AssemblyFileVersion in every AssemblyInfo.cs if the files in solution
# change with the build part of the version number to be year & day of the year
# and the revision part with to be 1 & hour & minute.
# For example v1.0 commited at 15/06/2017 at 03:47 will become 1.0.17166.10347
# Known issues: does not work with subfolder changes
list_files() {
milolav /
Last active May 6, 2019
Approach to making Dynamics 365 CE Reports available in the iPad app.

Making Dynamics 365 CE reports available in UCI on iOS devices

At the time of writing, Microsoft does not officially support running reports in an app on iOS / Android / Windows devices in the Unified Interface (UCI), but as it turns out, it's actually possible to display a report within the app using SiteMap entries pointing to Web Resources.

Reports are just another url in Dynamics and it seems the only reason why is that not working in the app is because every time you click on a item in the reports view it opens it in a new window.

First Idea

milolav /
Last active May 4, 2021
Making WhatsApp desktop application portable

Portable desktop WhatsApp

You start multiple instances of WhatsApp using --user-data-dir flag providing the full path to the directory. For example:

E:\Temp\Whatsapp>WhatsApp.exe --user-data-dir=E:\Temp\Whatsapp\number1

or by creating a shortcut with the flag.

milolav / java_extract.bat
Created Apr 17, 2017
Batch file to extract portable version of java jre or jdk from installer
View java_extract.bat
@echo off
rem Batch file that extracts java from installer
rem Original topic on stackoverflow:
if [%1]==[] goto usage
set fn=%~n1
7z.exe e %1 .rsrc\1033\JAVA_CAB10\111
if errorlevel 1 goto err