Skip to content

Instantly share code, notes, and snippets.

View sach1t's full-sized avatar

Sachit sach1t

View GitHub Profile
@sach1t
sach1t / batman.sh
Last active July 21, 2022 02:59
Sway battery low notifier
#!/bin/bash
bat_low_threshold=$1
poll_interval=60 # seconds
function bat_high {
local cap=$(cat /sys/class/power_supply/BAT0/capacity)
if [[ $cap -lt $bat_low_threshold ]]; then
return 1
else
@sach1t
sach1t / cbdd.awk
Created December 4, 2016 17:51
Chrome Bookmark De-Duplicator
# 1. export bookmarks
# 2. awk -f cbdd.awk bookmarks_12_4_16.html > uniq.html
# 3. import uniq.html
BEGIN { FS = " " }
$2 ~ /^HREF/ {
if (!($2 in seen)) {
seen[$2]
print $0
@sach1t
sach1t / kulercolor.sh
Created September 25, 2016 02:52
Kuler Color Background for Gnome
COLOR_FILE='/tmp/colors'
if [ ! -e "$COLOR_FILE" ]; then
tmp_file=$(mktemp)
wget -q -O "$tmp_file" --header='Accept: text/html' --user-agent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0' 'https://kuler-api.adobe.com/feeds/rss/get.cfm?itemsPerPage=100&listType=popular'
grep -F "kuler:swatchHexColor" "$tmp_file" | sed 's/<[\/]*kuler:swatchHexColor>//g' | sed 's/ //g' > "$COLOR_FILE"
rm "$tmp_file"
fi
total_colors=$(wc -l "$COLOR_FILE" | cut -d' ' -f1)