This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function __timer_now { | |
printf %s "${EPOCHREALTIME//\./}" | |
} | |
function __timer_start { | |
timer_start=${timer_start:-$(__timer_now)} | |
} | |
function __timer_stop { | |
local delta_us=$(($(__timer_now) - timer_start)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CACHE_DIR="/tmp/golint-docker-$USER" | |
DEFAULT_CONFIG="$HOME/.golangci.yml" | |
mkdir -p "$CACHE_DIR" | |
if [ -f "$DEFAULT_CONFIG" ]; then | |
n=$(basename "$DEFAULT_CONFIG") | |
config_file=("-v" "${DEFAULT_CONFIG}:/$n") | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
filter="(bash|vi|mc)" | |
winpid=$(xprop -id $(xdotool getactivewindow) _NET_WM_PID|awk '{print $3}') | |
if [ -n "$winpid" ]; then | |
lpid=$(pstree -aApT ${winpid}|grep -E "\\-${filter},[0-9]+" -o|tail -n1|awk -F, '{print $2}') | |
if [ -n "${lpid}" ]; then | |
cd $(readlink /proc/${lpid}/cwd) | |
fi | |
fi | |
xterm & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import requests | |
import sys | |
token = 'YOUR_BOT_TOKEN_HERE' | |
msg = { | |
'chat_id': sys.argv[1], | |
'text': sys.argv[2], | |
"disable_web_page_preview":True, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# alias crontab=/path/to/crontab_wrapper.sh | |
while getopts ":r" opt | |
do | |
case $opt in | |
r) | |
read -r -n 1 -p "Do really want to remove current crontab? [Y/n]" confirm | |
echo | |
if [ "$confirm" != "Y" ]; then | |
exit 1 |