Skip to content

Instantly share code, notes, and snippets.

Avatar

Dominik Kohler kohlerdominik

  • Lucerne, Switzerland
View GitHub Profile
@kohlerdominik
kohlerdominik / closeApplication.ps1
Created Jan 5, 2021
Gracefully terminate applications from powershell
View closeApplication.ps1
# This script gracefully terminates all processes with the given name (first parameter) when it's run.
# It will also answer to a confirm message, if the process has one, by a given hotkey.
#
#
# signature: closeApplication.ps1 $ProcessName $ConfirmHotkey
#
#
# some simple examples how to use it:
# closeApplications.ps1 'notepad' close all open instances with the process name 'notepad' (you should try this)
# closeApplications.ps1 'winword' '%Y' close all open instances of word and and send ALT+Y if a confirmation window pops up
View QrBillWireGrid.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kohlerdominik
kohlerdominik / index.js
Last active Dec 15, 2020
Google Cloud Function to parse and send a Stackdriver Incident to Google Chat (Hangouts)
View index.js
/*
Example Request
{
"incident":{
"incident_id":"0.123",
"resource_id":"",
"resource_name":"some-resource-name",
"resource":{
"type":"gce_instance",
@kohlerdominik
kohlerdominik / bitbucket-pipelines.yml
Created Jan 13, 2020
Simple PHPUnit Testing in Bitbucket Pipeline
View bitbucket-pipelines.yml
pipelines:
pull-requests:
'**':
- step:
name: Build Testing
image: composer:latest
artifacts:
- "vendor/**"
script:
# Install php dependencies
@kohlerdominik
kohlerdominik / reconnect-networkd-drive.bat
Last active Dec 15, 2018
Reconnect a network from batch. Often this is necessary if you use network drives in a place where you have only wireless access, so when windows initializes the network is not ready yet.
View reconnect-networkd-drive.bat
:: HOW-TO ::
:: Copy this file to any directory in your computer
:: Adjust drive letter (dletter) and drive path (dpath)
:: Create a shortcut to the file
:: Change the run mode to minimized in shortcut properties
:: If you want to execute in on start: copy it to "shell:startup" (WIN+R)
:: Set the drive-letter and drive-path
SET dletter=Z:
@kohlerdominik
kohlerdominik / mbus-vif-lookup-table.php
Created Dec 12, 2018
Lookup Table for Mbus VIF Field
View mbus-vif-lookup-table.php
<?php
return
[ // Type Unit Multiplicator
1 => ['Energy', 'Wh', '0.01'],
2 => ['Energy', 'Wh', '0.1'],
3 => ['Energy', 'Wh', '1'],
4 => ['Energy', 'Wh', '10'],
5 => ['Energy', 'Wh', '100'],
6 => ['Energy', 'Wh', '1000'],
@kohlerdominik
kohlerdominik / gpio.sh
Last active Nov 27, 2018
Raspberry GPIO Helper with SYSFS Commands
View gpio.sh
#!/bin/sh
# $1 mode
# $2 gpio
# $3 write: value 0/off | 1/on
usage() {
# command help:
echo "
@kohlerdominik
kohlerdominik / raspberry-enable-serial-interface-uart.sh
Created Nov 19, 2018
Enable Serial Interface via UART for the Raspberry PI
View raspberry-enable-serial-interface-uart.sh
#!/bin/bash
# # # # # # # # # # # # # # # # # # #
# Enable Serial Interface via UART #
# # # # # # # # # # # # # # # # # # #
# Dominik Kohler @ 19.11.2018
# Tested on Raspbian Stretch (9.4)
@kohlerdominik
kohlerdominik / minmax.awk
Last active Sep 10, 2018
Find Min, Max, Avg and Sum of column with a simple input. See usage example for more information
View minmax.awk
#!/usr/bin/awk -f
# Usage example:
# get all of first column: ./minmax awk data.txt
# set a custom field separator (default: ,): ./minmax.awk -v fs=":" data.txt
# get all of the fourth column: ./minmax.awk -v column="4" data.txt
# get min of the first column: ./minmax.awk -v type="min" data.txt
# get min of the fourth column: ./minmax.awk -v column="4" -v type="min" data.txt
#
# valid "column": 1..no
You can’t perform that action at this time.