Created
May 8, 2010 11:06
-
-
Save TheLinx/394503 to your computer and use it in GitHub Desktop.
my binaries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# protip: this goes in your ~ | |
alias apt-install="sudo apt-get install" | |
alias apt-remove="sudo apt-get remove" | |
alias apt-purge="sudo apt-get purge" | |
alias apt-update="sudo apt-get update" | |
alias apt-autorm="sudo apt-get autoremove" | |
alias apt-upgrade="sudo apt-get upgrade" | |
alias apt-search="apt-cache search" | |
alias git-update="git add -A && git commit -m" | |
function git-push { | |
git push origin `git status | grep "# On branch" | sed 's/# On branch //'` | |
} | |
alias clipboard="xclip -selection c" | |
alias untar="tar -xzvf" | |
alias cover="metaflac *.flac --import-picture-from" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
file=`which $1` | |
if [ -z $file ]; then | |
file=$HOME/.bin/$1 | |
fi | |
cat $file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
catbin $@ | xclip -selection c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
file=`which $1` | |
if [ -z $file ]; then | |
file=$HOME/.bin/$1 | |
fi | |
sensible-editor $file | |
chmod a+x $file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
n="`basename $n .part`" | |
while [ 1 ]; do | |
if [ -e "$n" ]; then | |
break | |
fi | |
sleep 1 | |
done | |
mplayer "$n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env lua | |
require"lfs" | |
local d = {} | |
for n in lfs.dir"." do | |
if n:sub(1,1) ~= "." then | |
d[#d+1] = n | |
end | |
end | |
table.sort(d) | |
for num,name in pairs(d) do | |
os.execute(("mv %q %q"):format(name, ("Episode %02d%s"):format(num, name:sub(-4)))) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env lua | |
require"lfs" | |
t = {} | |
for n in lfs.dir"." do | |
if n:sub(1,1) ~= "." then | |
t[#t+1] = n | |
end | |
end | |
table.sort(t) | |
for n=1,#t do | |
if n%2 == 1 then | |
os.remove(t[n]) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# recursive ogg encoding | |
# originates from current pwd, outputs to the folder in the first argument | |
root="`pwd`" | |
function r { | |
cd "$1" | |
for n in *; do | |
if [ -d "$n" ]; then | |
r "$n" "$2" | |
else | |
dir="`echo $(pwd) | sed "s|$root||"`" | |
f="$dir/$n" | |
fn="`echo "$f" | sed "s|.flac|.ogg|"`" | |
oggenc "$root$f" -q 0 -o "$2/$fn" | |
fi | |
done | |
cd .. | |
} | |
r "$root" "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# thank you, sirupsen | |
WINTITLE="Terminal - " # Name of the window (or part of it) | |
PROGRAMNAME="gnome-terminal" # Name of the program, so it can be opened if there's no window currently | |
# Lists all windows, if there's one containing $WINTITLE it'll return 1, and bring the current instance of the program to the front. | |
if [ `wmctrl -l | grep -c "$WINTITLE"` != 0 ]; then | |
wmctrl -a "$WINTITLE" | |
# Else, it'll launch a new instance | |
else | |
$PROGRAMNAME & | |
fi | |
# We're good! | |
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env lua | |
-- for FLAC files named according to the [nixx] quality naming convention. | |
-- requires LuaFileSystem. | |
require"lfs" | |
-- for speed, load these functions into memory | |
-- no table lookups! | |
local tableInsert,ioPopen = table.insert,io.popen | |
local o = {} | |
for n in lfs.dir(lfs.currentdir()) do | |
if not (n == "." or n == "..") then | |
local x,y | |
if tonumber(n:sub(4, 5)) and n:sub(6,6) == "-" then | |
x = tonumber(n:sub(1, 2)) | |
y = tonumber(n:sub(4, 5)) | |
DEPTH = true | |
else | |
x = tonumber(n:sub(1, 2)) | |
end | |
local name = ioPopen('metaflac "'..n..'" --show-tag=TITLE --no-utf8-convert'):read("*all") | |
if y then | |
if not o[x] then o[x] = {} end | |
o[x][y] = y..". "..name:sub(7) | |
else | |
o[x] = x..". "..name:sub(7) | |
end | |
end end | |
-- we use tables because repetitive concatenation in Lua is inefficient | |
-- http://www.lua.org/pil/11.6.html | |
-- the correct solution is to add strings to a table and then do a table concatenation: | |
if DEPTH then | |
for k,v in ipairs(o) do | |
print("CD "..k) | |
print(table.concat(o[k]):sub(0,-2)) | |
end | |
else | |
print(table.concat(o):sub(0,-2)) | |
end | |
-- hooray for speed! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Glad you could use my script. :D