Skip to content

Instantly share code, notes, and snippets.

View rchernobelskiy's full-sized avatar

Roman Chernobelskiy rchernobelskiy

View GitHub Profile
@rchernobelskiy
rchernobelskiy / sleep.sh
Last active September 6, 2023 09:01
Discourage use of mac during off hours by putting it to sleep automatically once a minute if it's awake
#!/bin/bash
if test $(date '+%H') -ge 22 || test $(date '+%H') -le 5; then
if expr $(date '+%M') % 2 && /usr/local/bin/brightness -l|grep -q 'active, awake, online'; then
cvol=$(osascript -e 'output volume of (get volume settings)')
#curb=$(brightness -l|tail -1|cut -d' ' -f4)
finishat=$(expr $(date '+%s') + 60)
while test $(date '+%s') -lt $finishat; do
#brightness 0
osascript -e "set volume output volume 0"
pmset displaysleepnow
@rchernobelskiy
rchernobelskiy / slack.tab.renamer.js
Last active December 7, 2022 18:47
Automatically remove asterisk from the title of the Slack tab (auto renames the tab when asterisk shows up) (install via tampermonkey)
// ==UserScript==
// @name Slack tab title asterisk remover
// @namespace http://roman.chernobelskiy/
// @version 0.2
// @description Permanently keeps the asterisk out of slack's tab title.
// @author Roman Chernobelskiy
// @match https://app.slack.com/*
// @grant none
// ==/UserScript==