Skip to content

Instantly share code, notes, and snippets.

View kohlerdominik's full-sized avatar

Dominik Kohler kohlerdominik

  • Lucerne, Switzerland
View GitHub Profile
@kohlerdominik
kohlerdominik / bucket-cors.json
Last active March 13, 2024 07:31
Google Cloud Storage Bucket - List all files in the bucket in the Browser (HTML/Javascript)
[
{
"maxAgeSeconds": 60,
"method": [
"GET"
],
"origin": [
"*"
],
"responseHeader": [
@kohlerdominik
kohlerdominik / closeApplication.ps1
Created January 5, 2021 15:58
Gracefully terminate applications from powershell
# 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
@kohlerdominik
kohlerdominik / mbus-vif-lookup-table.php
Created December 12, 2018 18:38
Lookup Table for Mbus VIF Field
<?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 / bitbucket-pipelines.yml
Created January 13, 2020 08:55
Simple PHPUnit Testing in Bitbucket Pipeline
pipelines:
pull-requests:
'**':
- step:
name: Build Testing
image: composer:latest
artifacts:
- "vendor/**"
script:
# Install php dependencies
@kohlerdominik
kohlerdominik / gist:12006028a487342bd84f5003e7484499
Last active April 5, 2022 09:18
Raspberry Pi with Raspbian Stretch: use bridge interfaces
sudo apt-get update && sudo apt-get install bridge-utils
sudo nano /etc/network/interfaces
iface eth0 inet manual
iface eth1 inet manual
auto eth0
iface br0 inet manual
bridge_ports eth0 eth1
@kohlerdominik
kohlerdominik / laravel-form-manipulator.js
Last active September 7, 2021 07:22
Laravel Form Manipulator | Multiple submit buttons in one form, each with their own action, target, method and confirmation.
/* Larvel Form Manipulator
* Enables Multiple submit buttons in one form, and manipulates form-action, form-method and crud-method.
* Usage:
* <input type="submit" value="Submit to alternative action" data-submit-action="/new-target">
* <input type="submit" value="Submit to alternative target" data-submit-target="_blank">
* <input type="submit" value="Submit as delete" data-submit-method="delete">
* <input type="submit" value="Submit with confirmation" data-submit-confirmation="Are you sure?">
* Of course it works with laravelcollective forms as well:
@kohlerdominik
kohlerdominik / docker-compose.yml
Created April 8, 2021 13:48
Docker Compose for node workspace
# docker-compose run workspace
services:
workspace:
image: node:slim
user: "node"
volumes:
- ${PWD}:/home/node/app:delegated
working_dir: /home/node/app
command: bash
@kohlerdominik
kohlerdominik / index.js
Last active December 15, 2020 18:54
Google Cloud Function to parse and send a Stackdriver Incident to Google Chat (Hangouts)
/*
Example Request
{
"incident":{
"incident_id":"0.123",
"resource_id":"",
"resource_name":"some-resource-name",
"resource":{
"type":"gce_instance",
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kohlerdominik
kohlerdominik / docker-and-docker-compose-on-wsl.md
Last active December 15, 2018 19:31
Docker & Docker-Compose in WSL engine on windows host