Skip to content

Instantly share code, notes, and snippets.

@Gen2ly
Gen2ly / ghsync-script
Created May 31, 2012 00:40
Create a github repository for scripts
#!/bin/bash
# Create a github repository for scripts
# Github repository name to use, Github repository address
gh_rp_nm="github_scripts"
gh_rp_dr="[email protected]:Gen2ly/scripts.git"
# Base directory, repository directory
base_dir=""$HOME"/.scripts/"
repo_dir=""$HOME"/.github-scripts/"
@Gen2ly
Gen2ly / crontab
Created May 31, 2012 02:07
Crontab for todd
# Schedule to run shell commands (dcron)
# user: todd
# DO NOT EDIT THIS FILE MANUALLY! USE crontab -e INSTEAD
# man 1 crontab for acceptable formats
# <mm> <hh> <DD> <MM> <dow> <tags and command> # dow: 0-6, Sun=0
# <@freq> <tags and command>
@weekly /home/todd/.scripts/others/github-sync-configs
@weekly /home/todd/.scripts/others/github-sync-scripts
@Gen2ly
Gen2ly / unity-effects
Created May 31, 2012 02:29
Toggle compositing effects of the Unity desktop
#!/bin/bash
# Toggle compositing effects of the Unity desktop
set -x
unity_2d="unity-2d-panel unity-2d-shell unity-2d-places unity-2d-launcher unity-2d-spread "
#unity_2d="unity-2d-panel unity-2d-shell"
start_2d() {
# Replace window manager
@Gen2ly
Gen2ly / pwr
Created May 31, 2012 14:08
Power management as a regular user
#!/bin/bash
# Power management as a regular user
case $1 in
shutdown | S )
echo " Shutting Down..."
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" \
/org/freedesktop/ConsoleKit/Manager \
org.freedesktop.ConsoleKit.Manager.Stop > /dev/null ;;
restart | R )
# bash interactive shell settings and additional specified commands
# Check for an interactive session
[ -z "$PS1" ] && return
# Custom Prompt
set_prompt_style () {
local bldpur='\e[1;35m' # Purple
local bldblu='\e[1;34m' # Blue
local bldblk='\e[1;30m' # Black - Bold
@Gen2ly
Gen2ly / ripcd
Created May 31, 2012 15:42
Rip CDs with given presets (requires cd-discid, sendmail )
#!/bin/bash
# Rip CDs with given presets (requires cd-discid, sendmail )
# Audio directory
aud_dir=~/Audio
# Sub-directory selection
printf "Select directory to rip disk to:\n"
select aud_sub_dir in "$aud_dir"/*/
do
@Gen2ly
Gen2ly / normalize-audio
Created May 31, 2012 15:44
Define normalization levels in mp3s (album-specifically)
#!/bin/bash
# Define normalization levels in mp3s (album-specifically)
audio_dir=~/Audio # Audio directory
sub_dir_inc=(Audiobooks Music Podcasts) # Sub-directories good to keep seperate
cd "$audio_dir"
for d in "${sub_dir_inc[@]}"; do
# -a keep gain even relative to albums, -k lower to not clip, -T modify orgin
# -d adjust volume by decibel amount (volume low on PSP)
@Gen2ly
Gen2ly / template
Created May 31, 2012 15:47
Description of script
#!/bin/bash
# Description of script
# Required program(s)
req_progs=(prog1 prog2)
for p in ${req_progs[@]}; do
hash "$p" 2>&- || \
{ echo >&2 " Required program \"$p\" not installed."; exit 1; }
done
@Gen2ly
Gen2ly / template-basic
Created May 31, 2012 15:47
Description of script
#!/bin/bash
# Description of script
# Display usage if no parameters given
if [[ -z "$@" ]]; then
echo " ${0##*/} <input> - description"
exit
fi
# Required program(s)
@Gen2ly
Gen2ly / vim2html
Created May 31, 2012 17:10
Create HTML code from Vim syntax highlighting (for use in coloring scripts)
#!/bin/bash
# Create HTML-colored code from Vim syntax highlighting
filename=$@
background=light
colorscheme=beauty256
#colorscheme=simple256
#colorscheme=peaksea
# Display usage if no parameters given