Skip to content

Instantly share code, notes, and snippets.

@milolav
milolav / java_extract.bat
Created April 17, 2017 18:55
Batch file to extract portable version of java jre or jdk from installer
@echo off
rem Batch file that extracts java from installer
rem Original topic on stackoverflow:
rem http://stackoverflow.com/questions/1619662/how-can-i-get-the-latest-jre-jdk-as-a-zip-file-rather-than-exe-or-msi-installe
setlocal
if [%1]==[] goto usage
set fn=%~n1
7z.exe e %1 .rsrc\1033\JAVA_CAB10\111
if errorlevel 1 goto err
@milolav
milolav / Portable_WhatsApp.md
Last active July 23, 2023 12:58
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
milolav / iPadUCIReports.md
Last active May 6, 2019 23:34
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
milolav / pre-commit
Last active May 14, 2019 19:55
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…
#!/bin/sh
#
# 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
milolav / Update-DynReleaseCalendar.ps1
Created June 6, 2019 22:58
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)
#
# 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
milolav / OwaGalExtractor.js
Last active May 22, 2024 12:04
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 https://outlook.office.com/people paste into console window and run one of the functions at the bottom.
/*!
OwaGalExtractor
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 () {
# Copyright (c) milolav
# MIT License
param (
[string]$WinIso,
[string]$VhdFile,
[string]$WinEdition = "Windows 10 Enterprise",
[long]$VhdSize = 40GB,
[char]$EfiLetter = 'R',
[char]$VirtualWinLetter = 'W',
@milolav
milolav / docker-certs.sh
Created April 9, 2020 18:33
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
#!/bin/sh
set -e
## Script to create certificates required for secure communication over https
## https://docs.docker.com/engine/security/https/
HOST=`hostname`
SUFFIX=`sed -n 's/^search \([^ ]*\).*/\1/p' /etc/resolv.conf`
SAN="IP:127.0.0.1"
if [ $HOST ]; then
SAN=$SAN,DNS:$HOST
@milolav
milolav / self-signed-cert.cmd
Created April 13, 2020 19:50
Quickly create self signed certificates with one or more domain names using openssl on windows
@echo off
setlocal
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
milolav / googleapi_oauth2_cert.sh
Created March 8, 2021 00:50
Oauth2 certificate authentication in bash for Microsoft Graph and Google APIs
set -e
client_email='[email protected]'
subject_email='[email protected]' #user that will be impersonated
scopes='https://www.googleapis.com/auth/<scope1> https://www.googleapis.com/auth/<scope2>'
key_file='my.key' #certificate private key (for signing)
jwt_header="{\"alg\":\"RS256\",\"typ\":\"JWT\"}"
ts=$(date +%s)