Add several macros to format Golang code and comment/uncomment and indent/unindent code blocks.
# ~/.local/share/mc/mc.macros
[editor]
ctrl-alt-f = ExecuteScript:0
ctrl-c = ExecuteScript:1
ctrl-alt-c = ExecuteScript:2
ctrl-tab = ExecuteScript:3Add several macros to format Golang code and comment/uncomment and indent/unindent code blocks.
# ~/.local/share/mc/mc.macros
[editor]
ctrl-alt-f = ExecuteScript:0
ctrl-c = ExecuteScript:1
ctrl-alt-c = ExecuteScript:2
ctrl-tab = ExecuteScript:3| #!/usr/bin/env bash | |
| # Exit on any error | |
| set -o errexit -o pipefail -o noclobber -o nounset | |
| function msg() { | |
| local TYPE TEXT EXIT | |
| TYPE="$1" | |
| TEXT="$2" |
| # Usage: source <(curl -L https://jtyr.io/source/kubectl) | |
| TOOLS_DIR="${TOOLS_DIR:-/tmp/tools}" | |
| TOOLS_BIN_DIR="$TOOLS_DIR/bin" | |
| function get_goyq() { | |
| YQ="$TOOLS_BIN_DIR/yq" | |
| YQ_VERSION='4.30.4' | |
| if [[ -e $YQ ]]; then |
Instructions how to capture keyboard and mouse events and turn them into human readable output.
evtest without any argments and see which event device you need to use.evtest /dev/input/event5 | grep --line-buffered 'EV_KEY' | sed -r -e 's/.*\(KEY_/Keyboard: /' -e 's/\), value 0/ - UP/' -e 's/\), value 1/ - DOWN/' -e 's/\), value 2/ - HOLD/'Example of the output:
Keyboard: Z - DOWN
| #!/bin/sh | |
| # Get the total memory in kB | |
| if [ -f /bin/esxcli ]; then | |
| MEM=$(esxcli hardware memory get | grep Physical | awk '{printf("%d", $3/1000)}') | |
| elif [ -f /proc/meminfo ]; then | |
| MEM=$( (grep MemTotal /proc/meminfo 2>/dev/null || echo 'x unknown') | awk '{print $2}') | |
| else | |
| MEM='unknown' | |
| fi |
| #!/usr/bin/env python | |
| import argparse | |
| import atexit | |
| import getpass | |
| import logging | |
| import os | |
| import re | |
| import socket | |
| import sys |
| #!/usr/bin/env python | |
| import argparse | |
| import logging | |
| import requests | |
| import sys | |
| # Disable SSL warnings | |
| try: | |
| from requests.packages.urllib3.exceptions import InsecureRequestWarning |
| #!/bin/bash | |
| ### | |
| # | |
| # Description | |
| # ----------- | |
| # | |
| # Script which helps to configure resolv.conf based on information pushed by | |
| # the OpenVPN server. | |
| # |
| #!/bin/env python | |
| import json | |
| import sys | |
| ''' | |
| Description | |
| ----------- |
| ### | |
| # Shell script used to bootstrap Kubernetes on the play-with-k8s.com service | |
| ### | |
| # | |
| # Inspired by https://gist.github.com/jjo/78f60702fbfa1cbec7dd865f67a3728a | |
| # | |
| # Usage: | |
| # source <(curl -sL bit.do/jtyr-pwk-setup) | |
| # | |
| # Edit: |