Skip to content

Instantly share code, notes, and snippets.

Avatar

Volodymyr Shatskyi vlad-shatskyi

View GitHub Profile
@havenwood
havenwood / gemfile.rb
Created Mar 30, 2013
Create a Gemfile (irc)
View gemfile.rb
abort 'Aborting. Gemfile already exists.' if File.exists? 'Gemfile'
@requires = []
files = Dir['*.rb']
files.each do |file|
open file do |file|
file.each do |line|
@requires << line.chomp if line.start_with? 'require '
end
@vlad-shatskyi
vlad-shatskyi / notifyosd.zsh
Last active Dec 15, 2015 — forked from ihashacks/notifyosd.zsh
Displays a notification when a command, that takes over 10 seconds to execute, finishes and only if the current window isn't the terminal. Add to your .zshrc: [ -e path/to/notifyosd.zsh ] && . path/to/notifyosd.zsh
View notifyosd.zsh
function active-window-id {
echo `xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}'`
}
# end and compare timer, notify-send if needed
function notifyosd-precmd() {
if [ ! -z "$cmd" ]; then
cmd_end=`date +%s`
((cmd_time=$cmd_end - $cmd_start))
fi
@ihashacks
ihashacks / notifyosd.zsh
Last active Jan 18, 2019
pseudo undistract-me implementation in zsh Original undistract-me: http://mumak.net/undistract-me/
View notifyosd.zsh
# commands to ignore
cmdignore=(htop tmux top vim)
# end and compare timer, notify-send if needed
function notifyosd-precmd() {
retval=$?
if [[ ${cmdignore[(r)$cmd_basename]} == $cmd_basename ]]; then
return
else
if [ ! -z "$cmd" ]; then