Skip to content

Instantly share code, notes, and snippets.

View atelic's full-sized avatar

Eric Barbour atelic

View GitHub Profile
@atelic
atelic / pixellock.sh
Created May 13, 2015 03:35
Another i3lock script
#!/usr/bin/env bash
icon="$HOME/path/to/lock.png"
tmpbg='/tmp/screen.png'
(( $# )) && { icon=$1; }
scrot "$tmpbg"
convert "$tmpbg" -scale 10% -scale 1000% "$tmpbg"
convert "$tmpbg" "$icon" -gravity center -composite -matte "$tmpbg"
@atelic
atelic / todo_generator.rb
Last active August 29, 2015 14:21
Ruby script that finds all TODO comments in a file or multiple files and outputs to out.txt
#! /usr/bin/env ruby
if ARGV.empty?
puts "Please enter a file name"
exit
end
out_file = File.new("out.txt", "w+")
puts "Appending to output file..."
@atelic
atelic / google.py
Created May 15, 2015 05:05
Python 2 script that googles your argument with a small GUI
#!/usr/bin/python2
import os, urllib
google = os.popen('zenity --entry --text="Enter your search: " --title="goog.py"').read()
google = urllib.quote(google)
os.system('google-chrome-stable http://google.com/search?q=%s' % (google) )
@atelic
atelic / mkorg.rb
Last active August 29, 2015 14:21
A quick and dirty script that inserts my custom org-mode header into new files
#! /usr/bin/env ruby
if ARGV.empty?
puts "Please enter a file name"
end
new_file = ARGV[0]
org_file = File.new(new_file, "w+")
org_file.puts("#+HTML_HEAD: <link rel=\"stylesheet\" type=\"text/css\" href=\"http://thomasf.github.io/solarized-css/solarized-light.min.css\" />\n")
org_file.puts("#+TITLE: \n")
@atelic
atelic / is_running.sh
Created May 26, 2015 19:25
A bash script to check if a process is running
#! /bin/bash
process=$1
ps cax | grep $process > /dev/null
if [ $? -eq 0 ]; then
echo "process is running"
else
echo "process is not running"
fi
@atelic
atelic / findWithAttr.js
Last active August 29, 2015 14:24
Find with attribute in JS
// source: https://stackoverflow.com/questions/7176908/how-to-get-index-of-object-by-its-property-in-javascript
function findWithAttr(array, attr, value) {
for(var i = 0; i < array.length; i += 1) {
if(array[i][attr] === value) {
return i;
}
}
}
var Data = [
@atelic
atelic / kill-tmux.sh
Created July 8, 2015 04:00
Kill tmux and all processes it spawned
tmux list-panes -s -F "#{pane_pid} #{pane_current_command}" | grep -v tmux | awk '{print $1}' | xargs kill -9
@atelic
atelic / README.md
Last active August 29, 2015 14:24 — forked from mattsears/README.md

Todo.rb

Todo.rb is a simple command-line tool for managing todos. It's minimal, straightforward, and you can use it with your favorite text editor.

Getting Started

Todo.rb doesn't require any third-party gems so you can copy the file anywhere and use it as long as it's executable:

[core]
excludesfile = /Users/you/.gitignore
editor = emacsclient -t
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[user]
# Capitalized, short (50 chars or less) summary
# ----------------------------------------------|
#WIP:
#Add:
#Mod:
#Ref:
#Fix:
#Rem:
# More detailed description. Wrap at 70 characters