Skip to content

Instantly share code, notes, and snippets.

View atelic's full-sized avatar

Eric Barbour atelic

View GitHub Profile
@atelic
atelic / i3exit
Created April 6, 2015 13:00
Lock and logout script for i3wm
#!/bin/sh
lock(){
i3lock
}
case "$1" in
lock)
lock
;;
logout)
@atelic
atelic / i3prettylock.sh
Last active January 24, 2018 00:44
An i3lock script for a cool overlay blur
#!/bin/bash
LOCKDIR=/home/path/to/lock.png
scrot -e 'convert -blur 0x3 $f ~/lockbg.png;rm $f'
convert -gravity center -composite ~/lockbg.png $LOCKDIR/lock.png ~/lockfinal.png
i3lock -u -i ~/lockfinal.png
rm ~/lockfinal.png ~/lockbg.png
@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 / fizz_buzz.rb
Created May 13, 2015 05:04
Shortest FizzBuzz in ruby I can come up with
1.upto(100){|n|puts n%15==0?"FizzBuzz":n%5==0?"Buzz":n%3==0?"Fizz":n}
@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 / dmenu2.sh
Created May 15, 2015 05:13
An awesome dmenu2 script for a configurable program launcher
#!/bin/sh
# Define your battery device. Look up in '/sys/class/power_supply/' for a directory named 'BAT0' ( it also can be 'BAT1 or something else )
device='BAT0'
battery="$(cat /sys/class/power_supply/$device/capacity)%"
# Volume Status for alsa users
volume="$(amixer get Master | tail -1 | sed 's/.*\[\([0-9]*%\)\].*/\1/')"
# Define your preferred terminal
@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 / gulpfile.js
Created May 24, 2015 04:00
Basic gulpfile for minify and concat css and javascript
/*
Before using make sure you have:
npm install --save-dev gulp gulp-minify-css gulp-concat gulp-uglify gulp-autoprefixer gulp-sass
Make sure to change the directory names in the default watch function to the CSS/SCSS/SASS directories you are using so it reloads
*/
var gulp = require('gulp'),
minifyCSS = require('gulp-minify-css'),
concat = require('gulp-concat')
@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