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 | |
state="active" | |
threshold=10000 | |
while true; do | |
sleep 1 | |
idle=$(xprintidle) | |
if [[ "$idle" -lt "$threshold" && "$state" != "active" ]] ; then | |
state="active" |
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
GREEN := $(shell tput -Txterm setaf 2) | |
YELLOW := $(shell tput -Txterm setaf 3) | |
WHITE := $(shell tput -Txterm setaf 7) | |
RESET := $(shell tput -Txterm sgr0) | |
.PHONY: all build clean | |
all: help | |
## Build: |
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
# prompt customization for .bashrc | |
# `root` has a red prompt, others a yellow/brown one. | |
# If we are connected remotely, `@<hostname>` shows first. | |
build_ps1() { | |
local prompt_color='\[\e[33m\]' | |
local host='' | |
[[ $UID -eq 0 ]] && prompt_color='\[\e[1;31m\]' | |
[[ $SSH_TTY ]] && host="@$HOSTNAME " | |
echo "${prompt_color}${host}\w\[\e[0m\]" | |
} |
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
/* | |
Context: https://en.wikipedia.org/wiki/Tower_of_Hanoi | |
Test this code: https://playground.hugoblanc.com/snippet/wryG6Tqv6aZ | |
*/ | |
package main | |
import "fmt" | |
var a, b, c []int |
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 | |
if [ -f $1 ] ; then | |
case $1 in | |
*.tar.bz2) tar xjf $1 ;; | |
*.tar.gz) tar xzf $1 ;; | |
*.bz2) bunzip2 $1 ;; | |
*.rar) unrar x $1 ;; | |
*.gz) gunzip $1 ;; | |
*.tar) tar xf $1 ;; |
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
GOCMD=go | |
GOTEST=$(GOCMD) test | |
GOVET=$(GOCMD) vet | |
BINARY_NAME= | |
VERSION=$(shell git describe --tags) | |
DOCKER_REGISTRY?= | |
BUILD_DATE=$(shell date +'%Y-%m-%d_%H:%M:%ST%Z') | |
GREEN := $(shell tput -Txterm setaf 2) | |
YELLOW := $(shell tput -Txterm setaf 3) |
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
# i3 config relevant part | |
bindsym XF86AudioMute exec --no-startup-id "amixer -q set Master toggle; /path/to/notify-volume-mute.sh" | |
bindsym XF86AudioRaiseVolume exec --no-startup-id "amixer -q set Master 3%+ unmute; /path/to/notify-volume-set.sh" | |
bindsym XF86AudioLowerVolume exec --no-startup-id "amixer -q set Master 3%- unmute; /path/to/notify-volume-set.sh" |
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 | |
STATE=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | head -n 12 | tail -n1 | awk '{print $2}') | |
if [ "$STATE" == "charging" ]; then | |
exit 0 | |
fi | |
PERCENT=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | head -n 21 | tail -n1 | awk '{print $2}' | cut -d '%' -f1) | |
if [ $PERCENT -lt 20 ]; then | |
export DISPLAY=:0 |
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
GOCMD=go | |
GOTEST=$(GOCMD) test | |
GOVET=$(GOCMD) vet | |
BINARY_NAME=program-name | |
VERSION?=0.0.0 | |
DOCKER_REGISTRY?= | |
GREEN := $(shell tput -Txterm setaf 2) | |
YELLOW := $(shell tput -Txterm setaf 3) | |
WHITE := $(shell tput -Txterm setaf 7) |
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 | |
YELLOW='\033[1;33m' | |
NOCOLOR='\033[0m' | |
# Backblaze B2 configuration variables | |
B2_ACCOUNT="ACCOUNT" | |
B2_KEY="KEY" | |
B2_BUCKET="BUCKET-NAME" |
NewerOlder