Skip to content

Instantly share code, notes, and snippets.

@Gen2ly
Gen2ly / rm
Created May 31, 2012 18:30
rm replacement for regular user. Moves files to trash rather than
#!/bin/bash
# rm replacement for regular user. Moves files to trash rather than
# directly deleting them.
reg_rm=/bin/rm
# Display usage if no parameters given
if [[ -z "$@" ]]; then
echo " ${0##*/} <file, folder, link...> - rm replacement: move to trash rather than delete"
exit
@Gen2ly
Gen2ly / 90_touchpad-button-fix.sh
Created May 31, 2012 17:59
Switch touchpad/mouse buttons then back again to fix missing trackpad button presses bug
#!/bin/sh
# Switch touchpad/mouse buttons then back again to fix
# missing touchpad button presses bug
case "$1" in
resume | thaw )
export DISPLAY=:0
su -c - todd /home/todd/.scripts/bugfixes/touchpad-button-fix
;;
esac
@Gen2ly
Gen2ly / touchpad-button-fix.desktop
Created May 31, 2012 17:58
Switches touchpad/mouse buttons then back again (to fix missed touchpad button click bug)
[Desktop Entry]
Type=Application
Exec=/home/todd/.scripts/bugfixes/touchpad-button-fix
Icon=mousepad
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=Touchpad Button Fix
Comment=Switches touchpad/mouse buttons then back again (to fix missed touchpad button click bug)
@Gen2ly
Gen2ly / touchpad-button-fix
Created May 31, 2012 17:44
Touchpad-button-fix - toggles left and right mouse/touchpad buttons and back
#!/bin/bash
# Touchpad-button-fix - toggles left and right mouse/touchpad buttons and back
# Again (fixes issue with missed touchpad buttons clicks)
# Detect mouse button position, switch mouse button position, then switch back
for l in {1..2}; do
state=$(xmodmap -pp | sed -n '5p' | awk '{ print $2 }') # detect button posit.
if [ "$state" == "1" ]; then
xmodmap -e "pointer = 3 2 1" &> /dev/null
sleep 2
[Desktop Entry]
Name=External Monitor Configure
Type=Application
Exec=sh -c /home/todd/.scripts/bugfixes/externalmonitor
Icon=gnome-display-properties
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
X-GNOME-Autostart-Delay=5
Comment=Toggle external and built-in laptop monitor and set displaysize, font size and brightness
@Gen2ly
Gen2ly / sitepass-cb
Created May 31, 2012 17:32
Copy common, other, and their previous password to clipboard
#!/bin/bash
# Copy common, other, and their previous password to clipboard
stpw_dir=$HOME # directory containing password files
stpw_dro=$stpw_dir/.sitepass-old # directory containing old passwords
stpw_fc=$stpw_dir/.sitepass-com.txt # filename containing common passwd
stpw_fo=$stpw_dir/.sitepass-oth.txt # filename containing other passwd
stpw_fC=$(ls -1 $stpw_dro/.sitepass-com* | tail -n 1) #filename of previous comm
stpw_fO=$(ls -1 $stpw_dro/.sitepass-oth* | tail -n 1) #filename of previous othe
@Gen2ly
Gen2ly / sitepass-gn
Created May 31, 2012 17:32
Generate password for common and other use (websites, programs...)
#!/bin/bash
# Generate password for common and other use (websites, programs...)
stpw_dir=$HOME # directory containing password files
stpw_fc=$stpw_dir/.sitepass-com.txt # filename containing common passwd
stpw_fo=$stpw_dir/.sitepass-oth.txt # filename containing other passwd
# Required program(s)
req_progs=(pwgen)
for p in ${req_progs[@]}; do
@Gen2ly
Gen2ly / sitepass-ls
Created May 31, 2012 17:32
Edit list of websites, programs... using common password
#!/bin/bash
# Edit list of websites, programs... using common password
stpw_dir=$HOME # dir containing password files
sitelist="$stpw_dir"/.sitepass-ls.txt # filename of list
editor=vim # text editor preference
# Display usage if no parameters given
if [[ -z "$@" ]]; then
echo " ${0##*/} <option> <*add entry> - list of programs/sites using common pw
@Gen2ly
Gen2ly / externalmonitor
Created May 31, 2012 17:21
Toggle between laptop and external monitor
#!/bin/bash
# Toggle between laptop and external monitor
# Required program(s)
req_progs=(bc)
for p in ${req_progs[@]}; do
hash "$p" 2>&- || \
{ echo >&2 " Required program \"$p\" not installed."; exit 1; }
done
@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