Skip to content

Instantly share code, notes, and snippets.

@Gen2ly
Gen2ly / unpack
Created June 3, 2012 02:36
Extract common file formats
#!/bin/bash
# Extract common file formats
# Display usage if no parameters given
if [[ -z "$@" ]]; then
echo " ${0##*/} <archive> - extract common file formats)"
exit
fi
# Required program(s)
@Gen2ly
Gen2ly / grok
Created June 2, 2012 12:32
Search file(s) for keyword
#!/bin/bash
# Search file(s) for keyword
# Display usage if no parameters given
if [[ -z "$@" ]]; then
echo -e " ${0##*/} <string> <file/path> - search recursively for keyword in files"
exit
fi
if [ -z "$2" ]; then
@Gen2ly
Gen2ly / cmtstrip
Created June 1, 2012 15:36
Output file without comments or blanklines
#!/bin/bash
# Output file without comments or blanklines
# Display usage if no parameters given
if [ -z $1 ]; then
echo " ${0##*/} <*c> <filename> - print file w/o comments/blanklines - (c)lipboard"
exit 1
fi
case $1 in
@Gen2ly
Gen2ly / rps
Created June 1, 2012 15:36
Running program search
#!/bin/bash
# Running program search
ps aux | grep --color=always -i "$@" | grep -v grep | grep -v "$0"
@Gen2ly
Gen2ly / atget
Created June 1, 2012 12:35
Download trailers from Apple website
#!/bin/bash
# Download trailers from Apple website
saveloc="~/Desktop"
# Usage if no parameters given
if [[ -z $@ ]]; then
echo " atget <apple-trailer-url>"; exit
fi
@Gen2ly
Gen2ly / calc
Created June 1, 2012 12:15
Command line calculator
#!/bin/sh
# Command line calculator
# Display usage if no parameters given
if [ -z "$@" ]; then
echo " ${0##*/} <input> <*decimals> - command line calculator (-h for examples)"
exit
fi
# Decimal to be carried out to (uses four unless value is given)
@Gen2ly
Gen2ly / 95_g9led-random-color
Created June 1, 2012 02:32
Kill original g9led-random-color loop, run again
#!/bin/sh
# Kill original g9led-random-color loop, run again
case "$1" in
resume | thaw )
killall -9 g9led-random-color
export DISPLAY=:0
su -c - todd /home/todd/.scripts/others/g9led-random-color &
;;
esac
[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=Logitech G9 Mouse LED Random Color Changer
Comment=Change G9 mouse color as specific intervals
Exec=/home/todd/.scripts/others/g9led-random-color
Icon=mouse
StartupNotify=false
Terminal=false
Hidden=false
@Gen2ly
Gen2ly / g9led-random-color
Created June 1, 2012 02:29
Change Logitech G9 mouse led color to random color after specified period
#!/bin/bash
# Change Logitech G9 mouse led color to random color after specified period
# Minutes until change
minutes=10
MINUTES=$(($minutes*60))
# Generic array of colors
color=(000033 000066 000099 003300 006600 00CC00 00FF33 330000 330033 330066
333300 336600 33CC33 33FF00 33FF33 660000 660033 6600CC 6600FF 66FF00 66FF33
99FF00 99FF33 CC3300 CCCC00 CCFF00 CCFF33 FF0000 FF0033 FF0066 FF0099 FF3300
@Gen2ly
Gen2ly / mp3cat-mdir
Created June 1, 2012 02:23
Define span of multiple folders and join mp3s inside - useful for audio that
#!/bin/bash
# Define span of multiple folders and join mp3s inside - useful for audio that
# spans more than one CD
# Display usage if no parameters given
if [[ -z "$@" ]]; then
echo " ${0##*/} <dir1> <dir2> <filename>.mp3 - folder span mp3 join"
exit
fi