Skip to content

Instantly share code, notes, and snippets.

View mu88's full-sized avatar
πŸŒ‹
On very long vacation

Mirko πŸ‡ͺπŸ‡Ί πŸ‡ΊπŸ‡¦ mu88

πŸŒ‹
On very long vacation
View GitHub Profile
@mu88
mu88 / MountContainer.ps1
Created April 22, 2021 06:56
Combines KeePass and VeraCrypt for volume mounting
$KPScriptEXE = "C:\Program Files (x86)\KeePass Password Safe 2\KPScript.exe"
$KeePassFile = "C:\Users\me\Documents\me.kdbx"
$VeraCryptEXE = "C:\Program Files\VeraCrypt\VeraCrypt.exe"
$VeraCryptFile = "C:\Users\me\Documents\me.hc"
$VeraCryptEntryTitle = "VeraCrypt"
$output = & $KPScriptEXE -c:GetEntryString $KeePassFile -Field:Password -ref-Title:$VeraCryptEntryTitle -guikeyprompt
$pw = ($output -split '\n')[0]
$pw = $pw -replace "`n","" -replace "`r",""
& $VeraCryptEXE /q /v $VeraCryptFile /l u /p $pw
@mu88
mu88 / DeleteGitTags.ps1
Last active July 19, 2022 07:32
Delete several tags from Git repo
#!/usr/bin/pwsh
Clear-Host
$repository = "<<Git repository path to work on>>"
$releaseName = "<<Name of release>>"
$tagsToKeep = @("<<Tag to keep>>")
Set-Location -Path $repository
@mu88
mu88 / .gitconfig
Last active August 2, 2022 08:33
Git hook for Conventional Commits
[includeIf "gitdir:C:/source/GitHub/"]
path = .gitconfig-github
@mu88
mu88 / Bitbucket - Remove PR identifier from commit message title.js
Last active July 28, 2022 11:55
Bitbucket - Remove PR identifier from commit message
// ==UserScript==
// @name Bitbucket - Remove PR identifier from commit message title
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Moves the Pull Request identifier from the Git commit message title into the description
// @author mu88
// @match https://<<Bitbucket host>>/**/pull-requests/*/overview
// @icon https://<<Bitbucket host>>/s/-848199135/6d8324a/n1cn5w/1.0/_/download/resources/com.atlassian.bitbucket.server.bitbucket-webpack-INTERNAL:favicon/favicon.ico
// @grant none
// ==/UserScript==
@mu88
mu88 / README.md
Last active September 15, 2022 09:10
Automatically upgrade NuGet packages and create PR in Bitbucket

Automatically upgrade NuGet packages and create PR in Bitbucket

Since NuKeeper is deprecated, I dediced to write it very basic PowerShell script which does the same for our on-prem Bitbucket instance. It uses the .NET global tool dotnet-outdated.

Prerequisites

Some things that come to my mind about this script:

  • Tested with PowerShell 7.2.5 and Bitbucket 7.21 (on-prem)
  • Script has to be executed within an already cloned Git repository
  • Git repository must use http or https for the remote
  • There must be a user inside Bitbucket with write permissions. The user needs an HTTP Access Token to communicate with Bitbucket.
  • dotnet-outdated seems to have some issues with the old CSPROJ format, so make sure to use it only with the newer SDK-style projects.
@mu88
mu88 / Program.cs
Created May 15, 2023 14:44
Compare PostgreSQL and SQL Server regarding CanConnectAsync
using System.Diagnostics;
using Microsoft.EntityFrameworkCore;
using Testcontainers.MsSql;
using Testcontainers.PostgreSql;
var msSqlContainer = new MsSqlBuilder()
.WithImage(MsSqlBuilder.MsSqlImage.Replace("mcr.microsoft.com/", string.Empty))
.Build();
await msSqlContainer.StartAsync();
SqlServerContext.Port = msSqlContainer.GetMappedPublicPort(MsSqlBuilder.MsSqlPort);
@mu88
mu88 / main.py
Last active July 9, 2023 12:59
Display screenshot on Waveshare ePaper display
import framebuf
import gc
from machine import Pin, SPI, I2C
import network
import time
import urequests
import utime
class INA219:
def __init__(self, i2c_bus=1, addr=0x40):
@mu88
mu88 / script.js
Created July 17, 2023 06:16
Copy Jira ticket identifier
// ==UserScript==
// @name Copy Jira ticket identifier
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Concats the ticket number and title of a Jira ticket
// @author mu88
// @match https://<<Jira>>/browse/*
// @icon https://<<Jira>>/s/<<Change>>/_/images/fav-generic.png
// @grant none
// ==/UserScript==
@mu88
mu88 / script.ps1
Created July 17, 2023 06:17
Clean temporary dev stuff
$Continue = Read-Host "Do you want to continue? Enter 'Yes'"
if ($Continue -ne "Yes") {
exit
}
if (([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator") -ne $true) {
Write-Host "Run this script as admin"
exit
}
@mu88
mu88 / DeleteAllBinAndObjFolders.ps1
Created December 13, 2023 15:58
Recursively delete all bin and obj folders of C# within the current directory
dir .\ -include bin,obj* -recurse | foreach($_) { rd $_.fullname -Recurse -Force}