Skip to content

Instantly share code, notes, and snippets.

View kohlerdominik's full-sized avatar

Dominik Kohler kohlerdominik

  • Lucerne, Switzerland
  • 14:30 (UTC +02:00)
View GitHub Profile
@kohlerdominik
kohlerdominik / minmax.awk
Last active September 10, 2018 14:01
Find Min, Max, Avg and Sum of column with a simple input. See usage example for more information
#!/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
@kohlerdominik
kohlerdominik / raspberry-enable-serial-interface-uart.sh
Created November 19, 2018 09:41
Enable Serial Interface via UART for the Raspberry PI
#!/bin/bash
# # # # # # # # # # # # # # # # # # #
# Enable Serial Interface via UART #
# # # # # # # # # # # # # # # # # # #
# Dominik Kohler @ 19.11.2018
# Tested on Raspbian Stretch (9.4)
@kohlerdominik
kohlerdominik / gpio.sh
Last active November 27, 2018 19:23
Raspberry GPIO Helper with SYSFS Commands
#!/bin/sh
# $1 mode
# $2 gpio
# $3 write: value 0/off | 1/on
usage() {
# command help:
echo "
@kohlerdominik
kohlerdominik / reconnect-networkd-drive.bat
Last active December 15, 2018 11:37
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.
:: 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 / docker-and-docker-compose-on-wsl.md
Last active December 15, 2018 19:31
Docker & Docker-Compose in WSL engine on windows host
Loading
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 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",
@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 / 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 / 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