commit
31d49743a0
@ -0,0 +1,2 @@
|
||||
opt
|
||||
vim/bundle
|
@ -0,0 +1,5 @@
|
||||
# dot-files
|
||||
|
||||
This are my dot-files :-)
|
||||
|
||||
Installing them is easy. Just execute the `install` script.
|
@ -0,0 +1,76 @@
|
||||
#!/usr/bin/env ruby
|
||||
require 'getopt/std'
|
||||
require 'terminal-table'
|
||||
require 'whois'
|
||||
|
||||
headings = ["weight", "email"]
|
||||
$emails = []
|
||||
$counter = 0
|
||||
|
||||
opt = Getopt::Std.getopts("hHpl:w")
|
||||
|
||||
if ( (opt["l"] and ( not (/^[1-9][0-9]*$/.match(opt["l"])) or opt["l"].to_i < 1 ) ) or opt["h"] or opt["H"] )
|
||||
puts "#{$0} [options] [ip|hostname]"
|
||||
puts " -p No table, just text"
|
||||
puts " -l <lines> Maximum lines"
|
||||
puts " -w only matches with highest priority"
|
||||
exit 0
|
||||
end
|
||||
|
||||
def insert(value, email)
|
||||
if $emails.select{|a| a[1] == email}.count == 0
|
||||
$emails.push( [value + $counter, email] )
|
||||
$counter = $counter + 1
|
||||
elsif ( $emails.select{|a| a[1] == email}[0][0] > value+$counter )
|
||||
$emails.select{|a| a[1] == email}[0][0] = value+$counter
|
||||
$counter = $counter + 1
|
||||
end
|
||||
end
|
||||
|
||||
if ( ARGV.length == 1 )
|
||||
w = Whois::Client.new
|
||||
input = w.lookup(ARGV[0]).to_s
|
||||
else
|
||||
input = ARGF
|
||||
end
|
||||
|
||||
|
||||
input.each_line do |line|
|
||||
line = line.force_encoding("BINARY").encode("UTF-8", invalid: :replace, undef: :replace, replace: "?").force_encoding("UTF-8").gsub("\n",'')
|
||||
|
||||
if ( /% Abuse contact for '.*' is '(?<mail>[\-\w.]+@([a-z0-9][a-z\-0-9]+\.)+[a-z]{2,4})'/i =~ line )
|
||||
insert(0, mail.downcase)
|
||||
elsif ( /^OrgAbuseEmail:\s+(?<mail1>[\-\w.]+@([a-z0-9][a-z\-0-9]+\.)+[a-z]{2,4})/i =~ line )
|
||||
insert(100000, mail1.downcase)
|
||||
elsif ( /^abuse\-mailbox:\s+(?<mail2>[\-\w.]+@([a-z0-9][a-z\-0-9]+\.)+[a-z]{2,4})/i =~ line )
|
||||
insert(200000, mail2.downcase)
|
||||
elsif ( /^RAbuseEmail:\s+(?<mail3>[\-\w.]+@([a-z0-9][a-z\-0-9]+\.)+[a-z]{2,4})/i =~ line )
|
||||
insert(300000, mail3.downcase)
|
||||
elsif ( /^OrgTechEmail:\s+(?<mail4>[\-\w.]+@([a-z0-9][a-z\-0-9]+\.)+[a-z]{2,4})/i =~ line )
|
||||
insert(400000, mail4.downcase)
|
||||
elsif ( /e\-?mail.*(?<mail5>abuse@([a-z0-9][a-z\-0-9]+\.)+[a-z]{2,4})/i =~ line )
|
||||
insert(500000, mail5.downcase)
|
||||
elsif ( /(?<mail6>[\-\w.]+@([a-z0-9][a-z\-0-9]+\.)+[a-z]{2,4})/i =~ line )
|
||||
insert(700000, mail6.downcase)
|
||||
end
|
||||
end
|
||||
|
||||
$emails = $emails.sort_by {|a,b| a[0] <=> b[0]}
|
||||
|
||||
if opt["l"]
|
||||
$emails = $emails.first(opt["l"].to_i)
|
||||
end
|
||||
|
||||
if opt["w"]
|
||||
weight = $emails.first[0]-($emails.first[0]%100000);
|
||||
$emails.delete_if { |x| x[0]-(x[0]%100000) != weight }
|
||||
end
|
||||
|
||||
if ( opt["p"] )
|
||||
$emails.each do |l|
|
||||
puts l[1]
|
||||
end
|
||||
else
|
||||
table = Terminal::Table.new(rows: $emails, headings: headings)
|
||||
puts table
|
||||
end
|
@ -0,0 +1,71 @@
|
||||
#!/bin/python
|
||||
# vim:set ts=8 sts=8 sw=8 cc=80 tw=80 noet:
|
||||
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
import json
|
||||
import urllib.request
|
||||
|
||||
def get_page(url):
|
||||
f = urllib.request.urlopen(url)
|
||||
return f.readall().decode("utf-8")
|
||||
|
||||
def retrieve(url, filename):
|
||||
urllib.request.urlretrieve(url, filename)
|
||||
|
||||
def api_call(method, extreme_env):
|
||||
url = "http%s://%s%s%s" % \
|
||||
("s" if extreme_env["API_USE_SSL"] == "yes" else "",
|
||||
extreme_env["API_HOST"],
|
||||
extreme_env["API_PATH"], method)
|
||||
authtoken = extreme_env["API_AUTH"]
|
||||
request = urllib.request.Request(url, headers={"X-API-Auth": authtoken})
|
||||
f = urllib.request.urlopen(request)
|
||||
return json.loads(f.readall().decode("utf-8"))
|
||||
|
||||
def get_extreme_env(url):
|
||||
page = get_page(url)
|
||||
pattern = r"<script>.*?EXTREME_ENV.*?=(.*?);</script>"
|
||||
result = re.search(pattern, page)
|
||||
return json.loads(result.group(1))
|
||||
|
||||
def get_album(album_id, extreme_env):
|
||||
return api_call("albums/%s" % album_id, extreme_env)
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) != 2:
|
||||
print("usage: %s album-id" % sys.argv[0])
|
||||
sys.exit(1)
|
||||
album_id = sys.argv[1]
|
||||
print("ripping album id %s" % album_id)
|
||||
extreme_env = get_extreme_env("https://www.extrememusic.com")
|
||||
album = get_album(album_id, extreme_env)
|
||||
album_title = album["album"]["title"]
|
||||
album_no = album["album"]["album_no"]
|
||||
print("album's title: %s (%s)" % (album_title, album_no))
|
||||
output_directory = "%s - %s" % (album_no, album_title)
|
||||
if not os.path.exists(output_directory):
|
||||
os.makedirs(output_directory)
|
||||
tracks = album["track_sounds"]
|
||||
try:
|
||||
for track in tracks:
|
||||
version = track["version_type"]
|
||||
no = track["track_sound_no"]
|
||||
title = track["title"].strip()
|
||||
preview = track["assets"]["audio"]["preview_url"]
|
||||
suffix = (" (%s)" % version) \
|
||||
if version != "Full Version" else ""
|
||||
filename = "%s %s%s" % (no, title, suffix)
|
||||
filename = filename.replace("/", "-")
|
||||
print(filename)
|
||||
try:
|
||||
retrieve(preview, "%s/%s.mp3" % \
|
||||
(output_directory, filename))
|
||||
except urllib.error.HTTPError as e:
|
||||
print("%d @ URL: '%s'" % (e.code, preview))
|
||||
print("reason: '%s'" % e.reason)
|
||||
if e.code != 404:
|
||||
raise e
|
||||
except KeyboardInterrupt:
|
||||
print("download cancelled")
|
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
# optimize firefox sqlite databases
|
||||
|
||||
if [ `ps aux | grep -v grep | grep -c firefox` = "0" ] ; then
|
||||
IFS="
|
||||
"
|
||||
for i in `find ~/.mozilla -name \*.sqlite`; do
|
||||
echo "Optimizing \"$i\"..."
|
||||
sqlite3 $i vacuum
|
||||
sqlite3 $i reindex
|
||||
done
|
||||
echo "done"
|
||||
else
|
||||
echo "Firefox is running..."
|
||||
exit 1
|
||||
fi
|
||||
|
@ -0,0 +1,90 @@
|
||||
#!/bin/bash
|
||||
|
||||
O_LINK=0
|
||||
O_PLAIN=0
|
||||
|
||||
if command -v multimarkdown >> /dev/null ; then
|
||||
MKD="multimarkdown"
|
||||
elif command -v markdown >> /dev/null ; then
|
||||
MKD="markdown"
|
||||
else
|
||||
echo "Markdown not found!"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
usage() {
|
||||
echo "Usage:"
|
||||
echo " $0 [options] <input>"
|
||||
echo "Options:"
|
||||
if [ "$MKD" = "markdown" ] ; then
|
||||
echo " -l Make Headers clickable (Only with multimarkdown)"
|
||||
else
|
||||
echo " -l Make Headers clickable"
|
||||
fi
|
||||
echo " -o <file> Specify an outfile"
|
||||
echo " -t <string> Specify a title"
|
||||
echo " -p Plain HTML, no css"
|
||||
exit 1
|
||||
}
|
||||
|
||||
OUTFILE=""
|
||||
TITLE=""
|
||||
|
||||
# Read options
|
||||
while getopts lphHo:t: opt ; do
|
||||
case "$opt" in
|
||||
\-) break;;
|
||||
l) O_LINK=1 ;;
|
||||
p) O_PLAIN=1 ;;
|
||||
o) OUTFILE="$OPTARG";;
|
||||
t) TITLE="$OPTARG";;
|
||||
[hH]) usage ;;
|
||||
esac
|
||||
done
|
||||
shift $(expr $OPTIND - 1)
|
||||
|
||||
INFILE="$1"
|
||||
|
||||
if [ ! -f "$INFILE" ] ; then
|
||||
usage
|
||||
fi
|
||||
|
||||
BASENAME="$(basename $INFILE)"
|
||||
T_="$(echo -n $BASENAME|sed -re 's/\.(markdown|mkd|mk|md)$//')"
|
||||
[ "$OUTFILE" = "" ] && OUTFILE="${T_}.html"
|
||||
[ "$TITLE" = "" ] && TITLE="$(echo -n ${T_}|tr '_' ' ')"
|
||||
|
||||
|
||||
echo "<!DOCTYPE html>" > $OUTFILE
|
||||
echo "<html>" >> $OUTFILE
|
||||
echo " <head>" >> $OUTFILE
|
||||
echo " <title>$TITLE</title>" >> $OUTFILE
|
||||
if [ $O_PLAIN -eq 0 ] ; then
|
||||
echo " <style type=\"text/css\">" >> $OUTFILE
|
||||
echo " html {font:1em/1.5em "Bitstream Vera Sans","Verdana",sans-serif}" >> $OUTFILE
|
||||
echo " h1,h2,h3 {padding-bottom:0.1em}" >> $OUTFILE
|
||||
echo " h1 {border-bottom:0.01em solid #666}" >> $OUTFILE
|
||||
echo " h2 {border-bottom:0.01em solid #999}" >> $OUTFILE
|
||||
echo " h3 {border-bottom:0.01em dashed #ccc}" >> $OUTFILE
|
||||
echo " p {text-align: justify}" >> $OUTFILE
|
||||
echo " .small {font-size:0.75em}" >> $OUTFILE
|
||||
echo " .grey {color:#666666}" >> $OUTFILE
|
||||
echo " blockquote {margin:10px 0px;padding-left:10px;border-left:10px solid #ccc}" >> $OUTFILE
|
||||
echo " @media screen {body {max-width:800px;margin:auto}}" >> $OUTFILE
|
||||
echo " </style>" >> $OUTFILE
|
||||
fi
|
||||
if [ "$MKD" = "multimarkdown" -a $O_LINK -eq 1 ] ; then
|
||||
echo " <script src=\"http://code.jquery.com/jquery-1.7.1.min.js\" type=\"text/javascript\"></script>" >> $OUTFILE
|
||||
echo " <script type="text/javascript">" >> $OUTFILE
|
||||
echo " \$(document).ready(function() {" >> $OUTFILE
|
||||
echo " \$(\"h1,h2,h3,h4,h5,h6\").click(function() {" >> $OUTFILE
|
||||
echo " window.location.hash = '#' + \$(this).attr(\"id\");" >> $OUTFILE
|
||||
echo " });" >> $OUTFILE
|
||||
echo " });" >> $OUTFILE
|
||||
echo " </script>" >> $OUTFILE
|
||||
fi
|
||||
echo " </head>" >> $OUTFILE
|
||||
echo " <body>" >> $OUTFILE
|
||||
$MKD $INFILE >> $OUTFILE
|
||||
echo " </body>" >> $OUTFILE
|
||||
echo "</html>" >> $OUTFILE
|
@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
cat << EOS
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>##title##</title>
|
||||
<meta charset="utf-8">
|
||||
<style type="text/css">
|
||||
html{font:1em/1.5em "Bitstream Vera Sans","Verdana",sans-serif}h1,h2,h3{padding-bottom:0.1em}h1{border-bottom:0.01em solid #666}h2{border-bottom:0.01em solid #999}h3{border-bottom:0.01em dashed #ccc}p{text-align: justify}.small{font-size:0.75em}.grey{color:#666666}a:hover{color:#56c2e6}a{color:#47a1bf;text-decoration:underline}blockquote{margin:10px 0px;padding-left:10px;border-left:10px solid #ccc}@media screen{body {max-width:800px;margin:auto}pre{white-space:pre-wrap}}code{border:1px solid #999;background-color:#eee;border-radius:2px;padding: 1px 3px}pre>code{border:none;background-color:transparent;padding:0}.even{background-color:#fff}table{border-collapse:collapse;border:1px solid #000}td,th{border:1px solid #000;padding:0.15em}.odd{background-color:#ddd}.highlight{background:#eee;border:1px solid #999;border-radius:5px;padding:5px}.highlight pre{margin:0}.highlight .c{color:#998;font-style:italic}.highlight .err{color:#a61717;background-color:#e3d2d2}.highlight .k{font-weight:bold}.highlight .o{font-weight:bold}.highlight .cm{color:#998;font-style:italic}.highlight .cp{color:#999;font-weight:bold}.highlight .c1{color:#998;font-style:italic}.highlight .cs{color:#999;font-weight:bold;font-style:italic}.highlight .gd{color:#000;background-color:#fdd}.highlight .gd .x{color:#000;background-color:#faa}.highlight .ge{font-style:italic}.highlight .gr{color:#a00}.highlight .gh{color:#999}.highlight .gi{color:#000;background-color:#dfd}.highlight .gi .x{color:#000;background-color:#afa}.highlight .go{color:#888}.highlight .gp{color:#555}.highlight .gs{font-weight:bold}.highlight .gu{color:#800080;font-weight:bold}.highlight .gt{color:#a00}.highlight .kc{font-weight:bold}.highlight .kd{font-weight:bold}.highlight .kp{font-weight:bold}.highlight .kr{font-weight:bold}.highlight .kt{color:#458;font-weight:bold}.highlight .m{color:#099}.highlight .s{color:#d14}.highlight .na{color:#008080}.highlight .nb{color:#0086B3}.highlight .nc{color:#458;font-weight:bold}.highlight .no{color:#008080}.highlight .ni{color:#800080}.highlight .ne{color:#900;font-weight:bold}.highlight .nf{color:#900;font-weight:bold}.highlight .nn{color:#555}.highlight .nt{color:#000080}.highlight .nv{color:#008080}.highlight .ow{font-weight:bold}.highlight .w{color:#bbb}.highlight .mf{color:#099}.highlight .mh{color:#099}.highlight .mi{color:#099}.highlight .mo{color:#099}.highlight .sb{color:#d14}.highlight .sc{color:#d14}.highlight .sd{color:#d14}.highlight .s2{color:#d14}.highlight .se{color:#d14}.highlight .sh{color:#d14}.highlight .si{color:#d14}.highlight .sx{color:#d14}.highlight .sr{color:#009926}.highlight .s1{color:#d14}.highlight .ss{color:#990073}.highlight .bp{color:#999}.highlight .vc{color:#008080}.highlight .vg{color:#008080}.highlight .vi{color:#008080}.highlight .il{color:#099}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
EOS
|
||||
pandoc -f markdown -t html5 $@
|
||||
cat << EOS
|
||||
</body>
|
||||
</html>
|
||||
EOS
|
@ -0,0 +1,111 @@
|
||||
#!/bin/bash
|
||||
# Aufrufsyntax:
|
||||
# paste42.sh [-s] [-t "filetype"] [-l] [-h] [-u] file
|
||||
|
||||
# Variablen initialisieren & defaults setzen
|
||||
VERSION="20110621.1"
|
||||
ATTR=''
|
||||
OPTS=""
|
||||
EXP='0'
|
||||
TYPE="text"
|
||||
TYPES="4cs 6502acme 6502kickass 6502tasm 68000devpac abap actionscript3 actionscript ada algol68 apache applescript apt_sources asm asp autoconf autohotkey autoit avisynth awk bascomavr bash basic4gl bf bibtex blitzbasic bnf boo caddcl cadlisp cfdg cfm chaiscript cil c_loadrunner clojure c_mac cmake cobol coffeescript c cpp cpp-qt csharp css cuesheet dcs delphi diff div dos dot d ecmascript eiffel email epc e erlang euphoria f1 falcon fo fortran freebasic fsharp gambas gdb genero genie gettext glsl gml gnuplot go groovy gwbasic haskell hicest hq9plus html4strict html5 icon idl ini inno intercal io java5 java javascript j jquery kixtart klonec klonecpp latex lb lisp llvm locobasic logtalk lolcode lotusformulas lotusscript lscript lsl2 lua m68k magiksf make mapbasic matlab mirc mmix modula2 modula3 mpasm mxml mysql newlisp nsis oberon2 objc objeck ocaml-brief ocaml oobas oracle11 oracle8 oxygene oz pascal pcre perl6 perl per pf php-brief php pic16 pike pixelbender pli plsql postgresql povray powerbuilder powershell proftpd progress prolog properties providex purebasic pycon python qbasic q rails rebol reg robots rpmspec rsplus ruby sas scala scheme scilab sdlbasic smalltalk smarty sql systemverilog tcl teraterm text thinbasic tsql typoscript unicon uscript vala vbnet vb verilog vhdl vim visualfoxpro visualprolog whitespace whois winbatch xbasic xml xorg_conf xpp yaml z80 zxbasic"
|
||||
pw=0
|
||||
|
||||
trap 'stty echo;exit 1;' 3 9 15
|
||||
|
||||
usage() {
|
||||
echo "Usage:"
|
||||
echo " $0 [-s] [-t \"type\"] [-l] [-e 10m|1h|1d|1w|4w|1y|date] file"
|
||||
echo " -s not \"public\""
|
||||
echo " -t <type> file type"
|
||||
echo " -l filetypes"
|
||||
echo " -h this help"
|
||||
echo " -u check for update"
|
||||
echo " -e <time> expiration:"
|
||||
echo " 10m = 10 minutes ; 1h = 1 hour ; 1d = 1day ;"
|
||||
echo " 1w = 1 week ; 4w = 4weeks ; 1y = 1 year ;"
|
||||
echo " or date: YYYY-MM-DD HH:II:SS"
|
||||
echo " -p set a password to delete the paste"
|
||||
echo ""
|
||||
echo "Version: $VERSION"
|
||||
}
|
||||
|
||||
filetypes() {
|
||||
echo "Filetypes:"
|
||||
for i in $TYPES ; do
|
||||
echo " $i"
|
||||
done
|
||||
}
|
||||
|
||||
checkUpdate() {
|
||||
SERV_VER=$(curl -s -S 'http://git.thomasba.de/cgit/paste42/plain/paste42.sh' | sed -e '/^VERSION=.*/ !d;s/VERSION="\(.*\)"/\1/')
|
||||
if [ "$SERV_VER" != "$VERSION" ] ; then
|
||||
echo "Update available!"
|
||||
echo "Your version: $VERSION"
|
||||
echo "Remote Version: $SERV_VER"
|
||||
else
|
||||
echo "No Updates."
|
||||
fi
|
||||
}
|
||||
|
||||
# wenn keine argumente, usage ausgeben
|
||||
if [ $# -eq 0 ] ; then usage ; exit ; fi
|
||||
|
||||
# argumente auswerten
|
||||
while getopts pst:lhue: opt ; do
|
||||
case "$opt" in
|
||||
\-) break;;
|
||||
s) ATTR=$ATTR' -d sec=true';;
|
||||
t) TYPE=$OPTARG;;
|
||||
[hH]) usage;exit;;
|
||||
l) filetypes;exit;;
|
||||
u) checkUpdate;exit;;
|
||||
p) pw=1;;
|
||||
e) ATTR=$ATTR' -d exp='$(echo $OPTARG|sed -e 's/[^0-9:\.a-zA-Z ,]//g');;
|
||||
esac
|
||||
done
|
||||
shift $(expr $OPTIND - 1)
|
||||
|
||||
# wenn dateiname leer ist, beenden
|
||||
if [ -z "$1" ] ; then
|
||||
usage
|
||||
exit
|
||||
fi
|
||||
|
||||
# wenn datei nicht existiert oder nicht lesbar ist, suizid
|
||||
if [ ! -f "$1" -o ! -r "$1" ] ; then
|
||||
echo "File \"$1\" not readable!" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -s "$1" ] ; then
|
||||
echo "File is empty!" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ -b "$1" -o -c "$1" -o -S "$1" -o -d "$1" ] ; then
|
||||
echo "\"$1\" is no ordinary file!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# meckern, wenn mehr als eine datei angegeben wurde...
|
||||
if [ $# -gt 1 ] ; then
|
||||
echo "only the first file will be used ;)" >&2
|
||||
fi
|
||||
|
||||
if [ $pw -eq 1 ] ; then
|
||||
echo "Please choose the Passwort:"
|
||||
password="";password2="1"
|
||||
while [ ! "$password" = "$password2" ] ; do
|
||||
if [ ! "$password" = "" ] ; then echo "The passwords didn't match." ; fi
|
||||
echo -ne " Password: "
|
||||
stty -echo ; read password ; stty echo
|
||||
echo -ne "\n Repeat the password: "
|
||||
stty -echo ; read password2 ; stty echo
|
||||
echo ""
|
||||
done
|
||||
fi
|
||||
|
||||
filename=`basename $1`
|
||||
|
||||
# und die daten absenden.
|
||||
curl -s -S --data-urlencode "del=$password" -d "title=curl paste of $filename" $ATTR -d "type=$TYPE" --data-urlencode "text@$1" 'http://paste42.de/save'
|
@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
hosts=()
|
||||
i=0
|
||||
|
||||
# print_host <name> <hostname> <cluster-ip>
|
||||
function print_host() {
|
||||
let i=i+1
|
||||
IP1=$(dig +short $2|tail -n1)
|
||||
hosts[$i]="$2"
|
||||
if [[ "$IP1" == "$3" ]] ; then
|
||||
echo " $i) $1 [$IP1] (active)"
|
||||
else
|
||||
echo " $i) $1 [$IP1]"
|
||||
fi
|
||||
}
|
||||
|
||||
ZEUS=$(dig +short zeus.lima-premium.de|tail -n1)
|
||||
echo "zeus: [$ZEUS]"
|
||||
print_host "megatron" "megatron.trafficplex.de" $ZEUS
|
||||
print_host "optimusprime" "optimusprime.trafficplex.de" $ZEUS
|
||||
|
||||
HERA=$(dig +short hera.lima-premium.de|tail -n1)
|
||||
echo "hera: [$HERA]"
|
||||
print_host "starscream" "starscream.trafficplex.de" $HERA
|
||||
print_host "bumblebee" "bumblebee.trafficplex.de" $HERA
|
||||
|
||||
echo -n "> "
|
||||
read choice
|
||||
while [ $choice -lt 1 -o $choice -gt $i ] ; do
|
||||
echo -n "> "
|
||||
read choice -p "> "
|
||||
done
|
||||
|
||||
ssh ${hosts[$choice]}
|
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
# export PATH=$PATH:/usr/local/bin
|
||||
|
||||
# abort if we're already inside a TMUX session
|
||||
[ "$TMUX" == "" ] || exit 0
|
||||
# startup a "default" session if non currently exists
|
||||
# tmux has-session -t _default || tmux new-session -s _default -d
|
||||
|
||||
# present menu for user to choose which workspace to open
|
||||
PS3="Please choose your session: "
|
||||
options=($(tmux list-sessions -F "#S") "New Session" "zsh")
|
||||
echo "Available sessions"
|
||||
echo "------------------"
|
||||
echo " "
|
||||
select opt in "${options[@]}"
|
||||
do
|
||||
case $opt in
|
||||
"New Session")
|
||||
read -p "Enter new session name: " SESSION_NAME
|
||||
tmux -2 new -s "$SESSION_NAME"
|
||||
break
|
||||
;;
|
||||
"zsh")
|
||||
zsh --login
|
||||
break;;
|
||||
*)
|
||||
tmux -2 attach-session -t $opt
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
@ -0,0 +1,40 @@
|
||||
#!/bin/sh
|
||||
|
||||
lnr="1"
|
||||
|
||||
while getopts n opt ; do
|
||||
case "$opt" in
|
||||
n) lnr="0" ;;
|
||||
\-) break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $(expr $OPTIND - 1)
|
||||
file=$(mktemp)
|
||||
|
||||
if [ -z "$2" ] ; then
|
||||
title="No Title"
|
||||
else
|
||||
title="$2"
|
||||
fi
|
||||
|
||||
cat > $file
|
||||
|
||||
vim -nEs $file +"syntax on" \
|
||||
+"set t_Co=256 ft=$1 tabstop=4 fileencodings=ucs-bom,utf-8,latin,windows-1252" \
|
||||
+"colorscheme wombat256_thomasba" \
|
||||
+"let html_no_progress=1" \
|
||||
+"let html_use_css=1" \
|
||||
+"let html_number_lines=$lnr" \
|
||||
+"let html_use_xhtml=1" \
|
||||
+"run! syntax/2html.vim" \
|
||||
+"w! $file.html" \
|
||||
+"qall!" &>/dev/null
|
||||
|
||||
sed -i 's_<title>/tmp/.*</title>_<title>'"$title"'</title>_' $file.html
|
||||
sed -i '/^<style type="text\/css">/,/^<\/style>/d' $file.html
|
||||
sed -i 's/^<\/head>/<link href="vim.css" type="text\/css" rel="stylesheet"\/>\n<\/head>/' $file.html
|
||||
|
||||
rm $file
|
||||
cat $file.html
|
||||
rm $file.html
|
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
CARD=$(aplay -l|sed -n 's/^Karte \([0-9]\+\): .*G930.*$/\1/p')
|
||||
CH="PCM"
|
||||
|
||||
if [ $# -eq 0 ] ; then
|
||||
echo "Usage: $0 ±<int>"
|
||||
echo " ±<int> change volume relative"
|
||||
echo " <int> set volume to <int>"
|
||||
exit 1
|
||||
elif [[ $1 = +[0-9]* ]] || [[ $1 = -[0-9]* ]] ; then
|
||||
volume="$1"
|
||||
#amixer -q -c 0 -- sset Master playback $(calc $(amixer sget Master | sed -rn 's/^.*Front Right: [^\[]*\[([0-9]+)%\].*$/\1/p')$volume)%
|
||||
amixer -c $CARD set $CH $(echo $1|sed -e 's/^\(.\)\(.*\)$/\2%\1/') > /dev/null
|
||||
elif [[ $1 = [0-9]* ]] ; then
|
||||
volume=$1
|
||||
amixer -q -c $CARD -- sset $CH playback $volume%
|
||||
else
|
||||
echo "Usage: $0 ±<int>"
|
||||
echo " ±<int> change volume relative"
|
||||
echo " <int> set volume to <int>"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -0,0 +1,7 @@
|
||||
[user]
|
||||
email = git@thomasba.de
|
||||
name = thomasba
|
||||
[push]
|
||||
default = simple
|
||||
[color]
|
||||
ui = true
|
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
nm-applet --sm-disable &
|
||||
dropbox start &
|
||||
owncloud&
|
||||
lxpolkit &
|
||||
|
||||
pidof pa-applet
|
||||
if [ $? -eq 1 ] ; then
|
||||
pa-applet &
|
||||
fi
|
||||
|
||||
start-pulseaudio-x11 &
|
||||
pamac-tray &
|
||||
xfce4-clipman &
|
||||
gnome-keyring-daemon --start --daemonize --components=pkcs11,secrets,ssh,gpg &
|
||||
xset r rate 400 30
|
||||
sleep 2 && xmodmap ~/.i3/speedswapper &
|
@ -0,0 +1,44 @@
|
||||
general {
|
||||
output_format = "i3bar"
|
||||
colors = true
|
||||
interval = 1
|
||||
}
|
||||
|
||||
order = "disk /"
|
||||
order += "disk /home"
|
||||
#order += "run_watch DHCP"
|
||||
#order += "run_watch VPN"
|
||||
order += "ethernet enp0s25"
|
||||
order += "load"
|
||||
order += "time"
|
||||
|
||||
ethernet enp0s25 {
|
||||
# if you use %speed, i3status requires root privileges
|
||||
#format_up = "E: %ip (%speed)"
|
||||
format_up = "E: %ip"
|
||||
format_down = "E: -"
|
||||
}
|
||||
|
||||
run_watch DHCP {
|
||||
pidfile = "/var/run/dhclient*.pid"
|
||||
}
|
||||
|
||||
run_watch VPN {
|
||||
pidfile = "/var/run/vpnc/pid"
|
||||
}
|
||||
|
||||
time {
|
||||
format = "%Y-%m-%d %H:%M:%S"
|
||||
}
|
||||
|
||||
load {
|
||||
format = "%1min %5min %15min"
|
||||
}
|
||||
|
||||
disk "/" {
|
||||
format = "r: %free"
|
||||
}
|
||||
|
||||
disk "/home" {
|
||||
format = "h: %free"
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
! Swap caps lock and escape
|
||||
remove Lock = Caps_Lock
|
||||
keysym Escape = Caps_Lock
|
||||
keysym Caps_Lock = Escape
|
||||
add Lock = Caps_Lock
|
@ -0,0 +1,139 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "#########################"
|
||||
echo "# #"
|
||||
echo "# installing dotfiles #"
|
||||
echo "# #"
|
||||
echo "#########################"
|
||||
|
||||
BACKUP_DIR="backup-$(date '+%Y-%m-%d_%H-%M-%S')"
|
||||
MY_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
CONFIG_MY_PATH="${MY_PATH/$HOME/\$\{HOME\}}"
|
||||
|
||||
function cecho() {
|
||||
if [ -z "$2" ] ; then
|
||||
echo "$1"
|
||||
else
|
||||
case $1 in
|
||||
red) echo -e "\e[0;31m$2\e[0m" ;;
|
||||
green) echo -e "\e[0;32m$2\e[0m" ;;
|
||||
yellow) echo -e "\e[0;33m$2\e[0m" ;;
|
||||
cyan) echo -e "\e[1;36m$2\e[0m" ;;
|
||||
purple) echo -e "\e[0;35m$2\e[0m" ;;
|
||||
white) echo -e "\e[1;37m$2\e[0m" ;;
|
||||
*) echo -e "\e[0;37m$2\e[0m" ;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
function backup_file() {
|
||||
file="${1/\~/$HOME}"
|
||||
if [ -e "$file" ] ; then
|
||||
if [ -d "$file" ] ; then
|
||||
cecho purple " - Moving old '$file' directory ..."
|
||||
else
|
||||
cecho purple " - Moving old '$file' file ..."
|
||||
fi
|
||||
mv "$file" "${BACKUP_DIR}/$(basename "${file}")"
|
||||
else
|
||||
cecho yellow " ! File '$file' not found! "
|
||||
fi
|
||||
}
|
||||
function symlink() {
|
||||
# usage: symlink <name> <destination>
|
||||
name="${1/\~/$HOME}"
|
||||
cecho green " + Creating symlink to '$2' ..."
|
||||
ln -s $2 $name
|
||||
}
|
||||
|
||||
#######
|
||||
# vim #
|
||||
#######
|
||||
|
||||
cecho cyan "Installing vim config ..."
|
||||
backup_file "~/.vim"
|
||||
backup_file "~/.vimrc"
|
||||
symlink "~/.vim" "${MY_PATH}/vim"
|
||||
symlink "~/.vimrc" "${MY_PATH}/vim/vimrc"
|
||||
if command -v vim >/dev/null 2>&1; then
|
||||
cecho green " + Installing plugins ... "
|
||||
vim -nE +"colorscheme default" +PluginInstall +qall
|
||||
else
|
||||
cecho yellow " ! Vim is not installed!"
|
||||
cecho yellow " ! to install the plugins execute:"
|
||||
cecho yellow " ! vim -nE +\"colorscheme default\" +PluginInstall +qall"
|
||||
fi
|
||||
|
||||
#######
|
||||
# zsh #
|
||||
#######
|
||||
|
||||
cecho cyan "Installing zsh config"
|
||||
backup_file "~/.zsh"
|
||||
backup_file "~/.zshrc"
|
||||
symlink "~/.zsh" "${MY_PATH}/zsh"
|
||||
if [ -d "${MY_PATH}/opt/oh-my-zsh/.git" ] ; then
|
||||
cecho green " + Pulling oh-my-zsh ..."
|
||||
(cd "${MY_PATH}/opt/oh-my-zsh" && git pull)
|
||||
else
|
||||
cecho green " + Cloning oh-my-zsh ..."
|
||||
git clone -q https://github.com/robbyrussell/oh-my-zsh.git "${MY_PATH}/opt/oh-my-zsh"
|
||||
fi
|
||||
while [ ! "$MTYPE" == "PC" -a ! "$MTYPE" == "SERVER" ] ; do
|
||||
cecho white "Is this a server of a PC? [s|p] > "
|
||||
read mt
|
||||
case $mt in
|
||||
[Ss]*)
|
||||
MTYPE="SERVER";;
|
||||
[Pp]*)
|
||||
MTYPE="PC";;
|
||||
*)
|
||||
cecho red " ! Invalid input";;
|
||||
esac
|
||||
done
|
||||
cecho green " + Creating .zshrc ... "
|
||||
(
|
||||
echo "# Path to your oh-my-zsh configuration."
|
||||
echo "ZSH=${CONFIG_MY_PATH}/opt/oh-my-zsh"
|
||||
echo "# current user"
|
||||
echo "export DEFAULT_USER=\"\$(whoami)\""
|
||||
echo "# machine type"
|
||||
echo "export MTYPE=\"$MTYPE\""
|
||||
echo "# load zshrc"
|
||||
echo "source \${HOME}/.zsh/zshrc"
|
||||
) > ~/.zshrc
|
||||
|
||||
########
|
||||
# tmux #
|
||||
########
|
||||
|
||||
cecho cyan "Installing tmux config"
|
||||
backup_file "~/.tmux.conf"
|
||||
symlink "~/.tmux.conf" "${MY_PATH}/tmux/tmux.conf"
|
||||
|
||||
######
|
||||
# i3 #
|
||||
######
|
||||
|
||||
cecho cyan "Installing i3 config"
|
||||
if [ "$MTYPE" == "PC" ] ; then
|
||||
backup_file "~/.i3"
|
||||
backup_file "~/.i3status.conf"
|
||||
symlink "~/.i3" "${MY_PATH}/i3"
|
||||
symlink "~/.i3status.conf" "${MY_PATH}/i3/i3status.conf"
|
||||
else
|
||||
cecho yellow " > skipping "
|
||||
fi
|
||||
|
||||
###############
|
||||
# other stuff #
|
||||
###############
|
||||
cecho cyan "Symlinking other stuff ..."
|
||||
|
||||
if [ "$MTYPE" == "PC" ] ; then
|
||||
backup_file "~/.xinitrc"
|
||||
backup_file "~/.pentadactylrc"
|
||||
symlink "~/.xinitrc" "${MY_PATH}/xinitrc"
|
||||
symlink "~/.pentadactylrc" "${MY_PATH}/pentadactylrc"
|
||||
fi
|
||||
|
||||
symlink "~/bin" "${MY_PATH}/bin"
|
@ -0,0 +1,8 @@
|
||||
"1.2pre-hg7140-default
|
||||
|
||||
loadplugins '\.(js|penta)$'
|
||||
group user
|
||||
set guioptions=bCrsT
|
||||
set hlfind
|
||||
|
||||
" vim: set ft=pentadactyl:
|
@ -0,0 +1,96 @@
|
||||
# status bar colors etc
|
||||
set-option -g status-bg black
|
||||
set-option -g status-fg blue
|
||||
set-option -g status-interval 5
|
||||
set-option -g visual-activity on
|
||||
set-window-option -g monitor-activity on
|
||||
set-window-option -g window-status-current-fg white
|
||||
|
||||
set -g default-terminal "screen-256color"
|
||||
|
||||
# command prefix
|
||||
set -g prefix C-a
|
||||
|
||||
# start window indexing at one instead of zero
|
||||
set -g base-index 1
|
||||
|
||||
unbind % # remove default binding since replacing
|
||||
bind v split-window -h
|
||||
bind h split-window -v
|
||||
bind R source-file ~/.tmux.conf \; display-message "Config reloaded..."
|
||||
|
||||
|
||||
# panes
|
||||
bind | split-window -h -c "#{pane_current_path}"
|
||||
bind - split-window -v -c "#{pane_current_path}"
|
||||
|
||||
bind Left select-pane -L
|
||||
bind Down select-pane -D
|
||||
bind Up select-pane -U
|
||||
bind Right select-pane -R
|
||||
bind h select-pane -L
|
||||
bind j select-pane -D
|
||||
bind k select-pane -U
|
||||
bind l select-pane -R
|
||||
# resize
|
||||
bind -r H resize-pane -L 2
|
||||
bind -r J resize-pane -D 2
|
||||
bind -r K resize-pane -U 2
|
||||
bind -r L resize-pane -R 2
|
||||
# resize
|
||||
bind -r S-Left resize-pane -L 2
|
||||
bind -r S-Down resize-pane -D 2
|
||||
bind -r S-Up resize-pane -U 2
|
||||
bind -r S-Right resize-pane -R 2
|
||||
# resize by 10
|
||||
bind -r A-Left resize-pane -L 10
|
||||
bind -r A-Down resize-pane -D 10
|
||||
bind -r A-Up resize-pane -U 10
|
||||
bind -r A-Right resize-pane -R 10
|
||||
|
||||
# synchronize all panes in a window
|
||||
bind y setw synchronize-panes
|
||||
|
||||
# other ^A
|
||||
unbind ^A
|
||||
bind ^A last-window
|
||||
|
||||
# Bind appropriate commands similar to screen.
|
||||
# lockscreen ^X x
|
||||
unbind ^X
|
||||
bind ^X lock-server
|
||||
|
||||
unbind " "
|
||||
bind " " next-window
|
||||
unbind n
|
||||
bind n next-window
|
||||
|
||||
unbind ^P
|
||||
bind ^P previous-window
|
||||
unbind BSpace
|
||||
bind BSpace previous-window
|
||||
|
||||
set-window-option -g xterm-keys on
|
||||
|
||||
# statusbar settings - adopted from tmuxline.vim and vim-airline - Theme: murmur
|
||||
set -g status-justify "left"
|
||||
set -g status "on"
|
||||
set -g status-left-style "none"
|
||||
set -g message-command-style "fg=colour144,bg=colour237"
|
||||
set -g status-right-style "none"
|
||||
set -g pane-active-border-style "fg=colour27"
|
||||
set -g status-utf8 "on"
|
||||
set -g status-style "bg=colour234,none"
|
||||
set -g message-style "fg=colour144,bg=colour237"
|
||||
set -g pane-border-style "fg=colour237"
|
||||
set -g status-right-length "100"
|
||||
set -g status-left-length "100"
|
||||
setw -g window-status-activity-attr "none"
|
||||
setw -g window-status-activity-style "fg=colour27,bg=colour234,none"
|
||||
setw -g window-status-separator ""
|
||||
setw -g window-status-style "fg=colour39,bg=colour234,none"
|
||||
set -g status-left "#[fg=colour15,bg=colour27] #S #[fg=colour27,bg=colour234,nobold,nounderscore,noitalics]"
|
||||
set -g status-right "#[fg=colour237,bg=colour234]#[fg=colour146,bg=colour237] #(uptime | rev | cut -d':' -f1 | rev) #[fg=colour239,bg=colour237,nobold,nounderscore,noitalics]#[fg=colour152,bg=colour239] %d.%m.%Y %H:%M #[fg=colour27,bg=colour239,nobold,nounderscore,noitalics]#[fg=colour15,bg=colour27] #h "
|
||||
setw -g window-status-format "#[fg=colour39,bg=colour234] #I #[fg=colour39,bg=colour234] #W "
|
||||
setw -g window-status-current-format "#[fg=colour234,bg=colour237,nobold,nounderscore,noitalics]#[fg=colour144,bg=colour237] #I #[fg=colour144,bg=colour237] #W #[fg=colour237,bg=colour234,nobold,nounderscore,noitalics]"
|
||||
|
@ -0,0 +1,51 @@
|
||||
" local syntax file - set colors on a per-machine basis:
|
||||
" vim: tw=0 ts=4 sw=4
|
||||
" Vim color file
|
||||
" Maintainer: Ron Aaron <ron@ronware.org>
|
||||
" Last Change: 2003 May 02
|
||||
|
||||
set background=dark
|
||||
hi clear
|
||||
if exists("syntax_on")
|
||||
syntax reset
|
||||
endif
|
||||
let g:colors_name = "elflord2"
|
||||
hi Normal guifg=cyan guibg=black
|
||||
hi Comment term=bold ctermfg=DarkCyan guifg=#80a0ff
|
||||
hi Constant term=underline ctermfg=Magenta guifg=Magenta
|
||||
hi Special term=bold ctermfg=DarkMagenta guifg=Red
|
||||
hi Identifier term=underline cterm=bold ctermfg=Cyan guifg=#40ffff
|
||||
hi Statement term=bold ctermfg=Yellow gui=bold guifg=#aa4444
|
||||
hi PreProc term=underline ctermfg=LightBlue guifg=#ff80ff
|
||||
hi Type term=underline ctermfg=LightGreen guifg=#60ff60 gui=bold
|
||||
hi Function term=bold ctermfg=White guifg=White
|
||||
hi Repeat term=underline ctermfg=White guifg=white
|
||||
hi Operator ctermfg=Red guifg=Red
|
||||
hi Ignore ctermfg=black guifg=bg
|
||||
hi Error term=reverse ctermbg=Red ctermfg=White guibg=Red guifg=White
|
||||
hi Todo term=standout ctermbg=Yellow ctermfg=Black guifg=Blue guibg=Yellow
|
||||
hi LineNr term=bold cterm=NONE ctermfg=DarkGrey ctermbg=NONE gui=NONE guifg=DarkGrey guibg=NONE
|
||||
|
||||
" Common groups that link to default highlighting.
|
||||
" You can specify other highlighting easily.
|
||||
hi link String Constant
|
||||
hi link Character Constant
|
||||
hi link Number Constant
|
||||
hi link Boolean Constant
|
||||
hi link Float Number
|
||||
hi link Conditional Repeat
|
||||
hi link Label Statement
|
||||
hi link Keyword Statement
|
||||
hi link Exception Statement
|
||||
hi link Include PreProc
|
||||
hi link Define PreProc
|
||||
hi link Macro PreProc
|
||||
hi link PreCondit PreProc
|
||||
hi link StorageClass Type
|
||||
hi link Structure Type
|
||||
hi link Typedef Type
|
||||
hi link Tag Special
|
||||
hi link SpecialChar Special
|
||||
hi link Delimiter Special
|
||||
hi link SpecialComment Special
|
||||
hi link Debug Special
|
@ -0,0 +1,4 @@
|
||||
augroup filetypedetect
|
||||
au BufRead,BufNewFile *.todo setfiletype todo
|
||||
au BufNewFile,BufRead *.markdown,*.mdown,*.mkd,*.mkdn,README.md setf markdown
|
||||
augroup END
|
@ -0,0 +1,6 @@
|
||||
|
||||
" HTML-Tags
|
||||
syn keyword htmlTagName contained article aside audio canvas command datalist
|
||||
syn keyword htmlTagName contained details embed figcaption figure footer header
|
||||
syn keyword htmlTagName contained hgroup keygen mark meter nav output progress
|
||||
syn keyword htmlTagName contained rp rt ruby section source summary time video
|
@ -0,0 +1,17 @@
|
||||
let g:markdown_fenced_languages = ['coffee', 'css', 'erb=eruby', 'javascript', 'js=javascript', 'json=javascript', 'ruby', 'sass', 'xml', 'html']
|
||||
|
||||
function! Markdown()
|
||||
exe "!".$HOME."/.vim/mkd -s '%'"
|
||||
endfunction
|
||||
command! Markdown call Markdown()
|
||||
|
||||
function! MkdUpdate()
|
||||
exe "!".$HOME."/.vim/mkd '%'"
|
||||
endfunction
|
||||
command! MkdUpdate call MkdUpdate()
|
||||
|
||||
nnoremap <F4> :MkdUpdate<CR>
|
||||
|
||||
" Highlight trailing whitespaces
|
||||
highlight mkdTrailingSpace ctermbg=22 guibg=#005f00
|
||||
match mkdTrailingSpace " \+$"
|
@ -0,0 +1,7 @@
|
||||
setlocal shiftwidth=4
|
||||
command! CheckPHP :! php -l %
|
||||
command! OpenPHP :! php %
|
||||
" run current PHP file through php
|
||||
noremap <leader>p :w!<CR>:!php %<CR>
|
||||
" run current PHP file through php linter (syntax check) check
|
||||
noremap <leader>l :!php -l %<CR>
|
@ -0,0 +1,20 @@
|
||||
" Thanks: Randy Morris <randy.morris@archlinux.us>
|
||||
|
||||
setlocal shiftwidth=4
|
||||
setlocal completefunc=pythoncomplete#Complete
|
||||
|
||||
let python_fold = 1
|
||||
let python_highlight_all = 1
|
||||
let python_highlight_exceptions = 1
|
||||
let python_highlight_space_errors = 1
|
||||
let python_highlight_builtins = 1
|
||||
|
||||
" Enable jumping to imports with gf
|
||||
python << EOF
|
||||
import os
|
||||
import sys
|
||||
import vim
|
||||
for p in sys.path:
|
||||
if os.path.isdir(p):
|
||||
vim.command(r"set path+=%s" % (p.replace(" ", r"\ ")))
|
||||
EOF
|
@ -0,0 +1,74 @@
|
||||
setlocal autochdir
|
||||
setlocal shiftwidth=4
|
||||
setlocal spell
|
||||
setlocal foldcolumn=3
|
||||
|
||||
let g:tex_flavor = "latex"
|
||||
|
||||
set foldcolumn=4
|
||||
|
||||
if $DISPLAY != ""
|
||||
command! ViewOutput :! (file="%"; pdflatex "$file" $>/dev/null && okular "${file/.tex/.pdf}" &>/dev/null) &
|
||||
command! MakeLatex :! (pdflatex % &>/dev/null) &
|
||||
command! MakeLatexV :! pdflatex %
|
||||
endif
|
||||
|
||||
":Snippet bin \binom{<{}>}{<{}>}<{}>
|
||||
":Snippet sec \<{section}>*{<{name}>}<cr>\addcontentsline{toc}{<{section}>}{<{name}>}<cr><cr><{}>
|
||||
":Snippet W Wahrscheinlichkeit <{}>
|
||||
":Snippet TM Turingmaschine <{}>
|
||||
":Snippet beg \begin{<{tag}>}<CR><{}><CR>\end{<{tag}>}
|
||||
":Snippet latex_head \documentclass[11pt]{scrartcl}<CR>\usepackage[utf8]{inputenc}<CR>\usepackage[ngerman]{babel}<CR>%\usepackage{amsmath}<CR>%\usepackage{amssymb}<CR>%\usepackage{multicol}<CR>%\usepackage{booktabs}<CR>%\usepackage{pstricks}<CR>%\usepackage{pst-node}<CR>\usepackage[paper=a4paper,left=30mm,right=20mm,top=20mm,bottom =25mm]{geometry}<CR>\usepackage[<CR> pdftitle={<{title}>},<CR> pdfsubject={<{subject}>},<CR> pdfauthor={<{author}>},<CR> pdfkeywords={<{title}>},<CR> pdfborder={0 0 0}<CR>]{hyperref}<CR>\usepackage{tabularx}<CR>%\usepackage{graphicx}<CR>\usepackage[usenames,dvipsnames]{color}<CR>\usepackage{lastpage}<CR>\usepackage{fancyhdr}<CR>\setlength{\parindent}{0ex}<CR>\setlength{\parskip}{2ex}<CR>\setcounter{secnumdepth}{4}<CR>\setcounter{tocdepth}{4}<CR>\definecolor{darkgreen}{rgb}{0,0.5,0}<CR>\definecolor{darkblue}{rgb}{0,0,0.5}<CR><CR>\pagestyle{fancy} %eigener Seitenstil<CR>\fancyhf{} %alle Kopf- und Fußzeilenfelder bereinigen<CR>\fancyhead[L]{<{title}>} %Kopfzeile links<CR>\fancyhead[C]{<{headermitte}>} %zentrierte Kopfzeile<CR>\fancyhead[R]{<{date}>} %Kopfzeile rechts<CR>\renewcommand{\headrulewidth}{0.4pt} %obere Trennlinie<CR>\fancyfoot[C]{Seite \thepage\ von \pageref{LastPage}}<CR>\renewcommand{\footrulewidth}{0.4pt} %untere Trennlinie<CR><CR>\newcommand{\spa}{\hspace*{4mm}}<CR>\newcommand{\defin}{\textcolor{darkgreen}{\textbf{Def.: }}}<CR>\newcommand{\rrfloor}{\right\rfloor}<CR>\newcommand{\llfloor}{\left\lfloor}<CR><CR><CR>\title{<{title}>}<CR>\author{<{author}>}<CR>\date{<{date}>}<CR><CR>\begin{document}<CR> \pagestyle{empty}<CR><CR> \maketitle\thispagestyle{empty}<CR> \tableofcontents\thispagestyle{empty}<CR> \newpage<CR> \pagestyle{fancy}<CR> \setcounter{page}{1}<CR><CR><{}><CR><CR>\end{document}
|
||||
":Snippet ra \Rightarrow <{}>
|
||||
":Snippet sum \sum\limits_{<{}>}^{<{}>} <{}>
|
||||
|
||||
function! Tex2Char()
|
||||
" remember cursor position:
|
||||
let s:line = line(".")
|
||||
let s:column = col(".")
|
||||
" if more than 'report' substitutions have been done, vim
|
||||
" displays it.
|
||||
let s:save_report = &report
|
||||
set report=99999
|
||||
" really nice Umlauts like Emacs iso-cvt writes
|
||||
%s/{\\"a}/ä/eIg
|
||||
%s/{\\"o}/ö/eIg
|
||||
%s/{\\"u}/ü/eIg
|
||||
%s/{\\"A}/Ä/eIg
|
||||
%s/{\\"O}/Ö/eIg
|
||||
%s/{\\"U}/Ü/eIg
|
||||
%s/{\\ss}/ß/eIg
|
||||
" normal styled Umlauts
|
||||
%s/\\"a/ä/eIg
|
||||
%s/\\"o/ö/eIg
|
||||
%s/\\"u/ü/eIg
|
||||
%s/\\"A/Ä/eIg
|
||||
%s/\\"O/Ö/eIg
|
||||
%s/\\"U/Ü/eIg
|
||||
%s/\\ss{}/ß/eIg
|
||||
%s/\\ss/ß/eIg
|
||||
" more rather normal styled Umlauts
|
||||
%s/\\"{a}/ä/eIg
|
||||
%s/\\"{o}/ö/eIg
|
||||
%s/\\"{u}/ü/eIg
|
||||
%s/\\"{A}/Ä/eIg
|
||||
%s/\\"{O}/Ö/eIg
|
||||
%s/\\"{U}/Ü/eIg
|
||||
%s/\\{ss}/ß/eIg
|
||||
" if you use package german or ngerman you can encode Umlauts like this
|
||||
%s/"a/ä/eIg
|
||||
%s/"o/ö/eIg
|
||||
%s/"u/ü/eIg
|
||||
%s/"A/Ä/eIg
|
||||
%s/"O/Ö/eIg
|
||||
%s/"U/Ü/eIg
|
||||
%s/"s/ß/eIg
|
||||
let &report=s:save_report
|
||||
unlet s:save_report
|
||||
call cursor(s:line,s:column)
|
||||
unlet s:line
|
||||
unlet s:column
|
||||
endfunction
|
||||
command! Tex2Char call Tex2Char()
|
||||
|
||||
au BufWritePost *.tex silent MakeLatex
|
@ -0,0 +1,183 @@
|
||||
source ~/.vim/vundle.vim
|
||||
|
||||
syntax on
|
||||
filetype plugin on
|
||||
filetype indent on
|
||||
filetype plugin on
|
||||
filetype plugin indent on
|
||||
|
||||
set copyindent
|
||||
|
||||
" delete always on backspace
|
||||
set backspace=indent,eol,start
|
||||
|
||||
if &term =~# '^\(screen\|xterm\)$'
|
||||
set t_Co=256
|
||||
endif
|
||||
if (&t_Co >= 255 && &term !~ '^linux$') || has("gui_running")
|
||||
colorscheme wombat256_thomasba
|
||||
else
|
||||
colorscheme elflord2
|
||||
endif
|
||||
|
||||
if has("gui_running")
|
||||
set guifont="Monospace 10"
|
||||
endif
|
||||
|
||||
set hidden
|
||||
set number
|
||||
set numberwidth=4
|
||||
set shiftwidth=4
|
||||
set ruler
|
||||
set showmode
|
||||
set noexrc
|
||||
set noerrorbells
|
||||
set nobackup
|
||||
set wrap
|
||||
set ts=4
|
||||
set diffopt+=iwhite
|
||||
set history=50
|
||||
|
||||
set showcmd
|
||||
set showmatch
|
||||
set smartcase
|
||||
|
||||
set ignorecase
|
||||
set title
|
||||
set ttyfast
|
||||
set hlsearch
|
||||
set spelllang=de_de,en
|
||||
|
||||
" move by screen lines, not by real lines - great for creative writing
|
||||
nnoremap j gj
|
||||
nnoremap k gk
|
||||
nnoremap <Up> gk
|
||||
nnoremap <Down> gj
|
||||
|
||||
" also in visual mode
|
||||
vnoremap j gj
|
||||
vnoremap k gk
|
||||
vnoremap <Up> gk
|
||||
vnoremap <Down> gj
|
||||
|
||||
nnoremap , :
|
||||
|
||||
set encoding=utf-8
|
||||
set fileencodings=ucs-bom,utf-8,latin,windows-1252
|
||||
|
||||
let g:html_prevent_copy = "fn"
|
||||
let html_use_xhtml=1
|
||||
let html_use_css=1
|
||||
|
||||
" slightly highlight rows and columns
|
||||
"set cursorline
|
||||
"set cursorcolumn
|
||||
|
||||
" mail
|
||||
augroup mail
|
||||
autocmd!
|
||||
autocmd FileType mail set textwidth=70 wrap fo=tcrq
|
||||
augroup END
|
||||
|
||||
" auto completion and menu
|
||||
set wildmode=list:longest:full
|
||||
set wildmenu
|
||||
|
||||
" Map keys to toggle functions
|
||||
function! MapToggle(key, opt)
|
||||
let cmd = ':set '.a:opt.'! \| set '.a:opt."?\<CR>"
|
||||
exec 'nnoremap '.a:key.' '.cmd
|
||||
exec 'inoremap '.a:key." \<C-O>".cmd
|
||||
endfunction
|
||||
|
||||
function! NumberToggle()
|
||||
if(&relativenumber == 1)
|
||||
set number
|
||||
else
|
||||
set relativenumber
|
||||
endif
|
||||
endfunc
|
||||
nnoremap <C-n> :call NumberToggle()<cr>
|
||||
|
||||
command! -nargs=+ MapToggle call MapToggle(<f-args>)
|
||||
" Keys & functions
|
||||
MapToggle <F4> number
|
||||
MapToggle <F5> spell
|
||||
MapToggle <F6> paste
|
||||
MapToggle <F7> hlsearch
|
||||
MapToggle <F8> wrap
|
||||
nnoremap <F9> <c-]>
|
||||
nnoremap <F10> :!ctags -R<cr>
|
||||
nnoremap <F11> :previous<cr>
|
||||
nnoremap <F12> :next<cr>
|
||||
|
||||
" make mcabber log pretty readable
|
||||
function! Mcabber()
|
||||
exec ':%s/[ ]\+$//'
|
||||
exec ':%s/^M[IR] \(\d\{4\}\)\(\d\d\)\(\d\d\)T\(\d\d:\d\d:\d\d\)Z \d\{3\}/\1-\2-\3 \4/'
|
||||
endfunction
|
||||
command! Mcabber call Mcabber()
|
||||
|
||||
" Mail quote transforming
|
||||
nmap ;m :%s/^\(> \)\+>/\=substitute(submatch(0),'> ','>','g')/ge<cr>ggVGgq
|
||||
nmap ;h :%s/^\(> \)\+>/\=substitute(submatch(0),'> ','>','g')/ge<cr>gg/^$<cr>VGgq
|
||||
nmap ;p ?^$<cr>V/^$<cr>gqk<end>:nohl<cr>
|
||||
|
||||
" help deobfuscate code
|
||||
function! CleanUpObfuscatedCode()
|
||||
exec ':%s/\([{};]\)/\1\r/g'
|
||||
exec ':%s/\\x\([0-9a-zA-Z]\{2\}\)/\=nr2char(str2nr(submatch(1),16))/g'
|
||||
exec 'normal gg=G'
|
||||
endfunction
|
||||
command! CleanUpObfuscatedCode call CleanUpObfuscatedCode()
|
||||
|
||||
let g:Powerline_symbols = 'unicode'
|
||||
set laststatus=2
|
||||
|
||||
noremap <leader>y "+y
|
||||
noremap <leader>Y "+Y
|
||||
noremap <leader>p "+
|
||||
|
||||
" Underline (Markdown Style)
|
||||
nnoremap <leader>= YpVr=
|
||||
nnoremap <leader>- YpVr-
|
||||
|
||||
"let g:neocomplcache_enable_at_startup = 1
|
||||
let g:indent_guides_auto_colors = 0
|
||||
|
||||
" Hide latex output
|
||||
let NERDTreeIgnore=['\~$','\.\(aux\|nav\|out\|snm\|toc\|vrb\|o\)$']
|
||||
|
||||
let g:tex_flavor = "latex"
|
||||
|
||||
" Large files >= 200
|
||||
let g:LargeFile = 200
|
||||
|
||||
" Nooo, dont blink!!
|
||||
set guicursor=a:blinkon0
|
||||
|
||||
let g:nerdtree_plugin_open_cmd = "xdg-open"
|
||||
let g:languagetool_jar = "/usr/share/java/languagetool/languagetool.jar"
|
||||
|
||||
set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
|
||||
|
||||
if has('gui_running')
|
||||
" Make shift-insert work like in Xterm
|
||||
map <S-Insert> <MiddleMouse>
|
||||
map! <S-Insert> <MiddleMouse>
|
||||
endif
|
||||
let g:languagetool_lang = "de"
|
||||
|
||||
set statusline+=%#warningmsg#
|
||||
set statusline+=%{SyntasticStatuslineFlag()}
|
||||
set statusline+=%*
|
||||
|
||||
let g:syntastic_always_populate_loc_list = 1
|
||||
let g:syntastic_auto_loc_list = 1
|
||||
let g:syntastic_check_on_open = 1
|
||||
let g:syntastic_check_on_wq = 0
|
||||
|
||||
let g:syntastic_perl_checkers = ['perl']
|
||||
let g:syntastic_enable_perl_checker = 1
|
||||
let g:syntastic_python_checkers = ['pylint']
|
||||
let g:syntastic_php_checkers = ['php']
|
@ -0,0 +1,65 @@
|
||||
set nocompatible " be iMproved, required
|
||||
filetype off " required
|
||||
|
||||
if !isdirectory(expand("~/.vim/bundle/Vundle.vim/.git"))
|
||||
!git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
|
||||
endif
|
||||
|
||||
set rtp+=~/.vim/bundle/Vundle.vim
|
||||
call vundle#begin()
|
||||
|
||||
" required!
|
||||
Plugin 'gmarik/Vundle.vim'
|
||||
|
||||
" color
|
||||
Plugin 'thomasba/wombat256.vim'
|
||||
|
||||
|
||||
" filetype
|
||||
Plugin 'vim-scripts/mcabberlog.vim'
|
||||
Plugin 'vim-scripts/apachelogs.vim'
|
||||
Plugin 'vim-scripts/syslog-syntax-file'
|
||||
Plugin 'othree/html5.vim'
|
||||
Plugin 'vim-scripts/bbcode'
|
||||
Plugin 'tpope/vim-markdown'
|
||||
Plugin 'vim-scripts/JSON.vim'
|
||||
|
||||
" Files
|
||||
Plugin 'scrooloose/nerdtree'
|
||||
"Plugin 'jistr/vim-nerdtree-tabs'
|
||||
Plugin 'kien/ctrlp.vim'
|
||||
if executable('ag')
|
||||
Plugin 'rking/ag.vim'
|
||||
elseif executable('ack')
|
||||
Plugin 'mileszs/ack.vim'
|
||||
endif
|
||||
|
||||
" Utility
|
||||
Plugin 'tpope/vim-speeddating'
|
||||
Plugin 'Lokaltog/vim-powerline'
|
||||
Plugin 'vim-scripts/Tagbar'
|
||||
Plugin 'vim-scripts/loremipsum'
|
||||
Plugin 'vim-scripts/LanguageTool'
|
||||
Plugin 'thinca/vim-localrc'
|
||||
Plugin 'mtth/scratch.vim'
|
||||
Plugin 'scrooloose/syntastic'
|
||||
"Plugin 'jeetsukumaran/vim-buffergator'
|
||||
Plugin 'ntpeters/vim-airline-colornum'
|
||||
Plugin 'tpope/vim-surround'
|
||||
Plugin 'vim-scripts/tComment'
|
||||
Plugin 'tpope/vim-fugitive'
|
||||
Plugin 'tmhedberg/matchit'
|
||||
Bundle 'chase/vim-ansible-yaml'
|
||||
|
||||
" test:
|
||||
"Plugin 'Yggdroot/indentLine'
|
||||
"Plugin 'honza/vim-snippets'
|
||||
Plugin 'lilydjwg/colorizer'
|
||||
"Plugin 'junegunn/vim-easy-align'
|
||||
"Plugin 'lervag/vimtex'
|
||||
"Plugin 'reedes/vim-pencil'
|
||||
"Plugin 'terryma/vim-multiple-cursors'
|
||||
"Plugin 'mbbill/undotree'
|
||||
Plugin 'Townk/vim-autoclose'
|
||||
|
||||
call vundle#end()
|
@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# ~/.xinitrc
|
||||
#
|
||||
# Executed by startx (run your window manager from here)
|
||||
#
|
||||
|
||||
export GTK2_RC_FILES="$HOME/.gtkrc-2.0"
|
||||
DESKTOP_SESSION=gnome
|
||||
|
||||
DEFAULT_SESSION=i3
|
||||
case $1 in
|
||||
xfce) exec dbus-launch xfce4-session ;;
|
||||
i3wm) exec dbus-launch i3 ;;
|
||||
*) exec dbus-launch $DEFAULT_SESSION ;;
|
||||
esac
|
||||
|
||||
eval $(/usr/bin/gnome-keyring-daemon --start --components=gpg,pkcs11,secrets,ssh)
|
||||
# You probably need to do this too:
|
||||
export GPG_AGENT_INFO SSH_AUTH_SOCK
|
@ -0,0 +1,121 @@
|
||||
# aliases
|
||||
|
||||
alias ta='tmux -2 attach'
|
||||
alias tmux='tmux -2'
|
||||
alias cd..='cd ..'
|
||||
alias :q='exit'
|
||||
alias e='vim'
|
||||
alias :e='vim'
|
||||
alias j='java'
|
||||
alias jj='java -jar'
|
||||
alias jc='javac'
|
||||
alias ll=' ls -al --group-directories-first'
|
||||
alias c="clear"
|
||||
alias g='gcc -Wall -pedantic'
|
||||
alias ga='gcc -Wall -pedantic -ansi'
|
||||
alias logo='exit'
|
||||
alias logout='exit'
|
||||
|
||||
alias -g NUL="> /dev/null 2>&1"
|
||||
|
||||
# functions
|
||||
|
||||
function extract () {
|
||||
if [ -f $1 ] ; then
|
||||
case $1 in
|
||||
*.tar.bz2) tar xvjf $1 ;;
|
||||
*.tar.gz) tar xvzf $1 ;;
|
||||
*.bz2) bunzip2 $1 ;;
|
||||
*.rar) unrar x $1 ;;
|
||||
*.gz) gunzip $1 ;;
|
||||
*.tar) tar xvf $1 ;;
|
||||
*.tbz2) tar xvjf $1 ;;
|
||||
*.tgz) tar xvzf $1 ;;
|
||||
*.zip) unzip $1 ;;
|
||||
*.Z) uncompress $1 ;;
|
||||
*.7z) 7z x $1 ;;
|
||||
*) echo "don't know how to extract '$1'..." ;;
|
||||
esac
|
||||
else
|
||||
echo "'$1' is not a valid file!"
|
||||
fi
|
||||
}
|
||||
function mkcd () {
|
||||
[ $# -eq 1 ] && {
|
||||
mkdir -p "$1"
|
||||
cd "$1"
|
||||
} || echo "usage: mkcd <dir>"
|
||||
}
|
||||
alias myip='curl myip.paste42.de;echo'
|
||||
alias myip4='curl myipv4.paste42.de;echo'
|
||||
alias myip6='curl myipv6.paste42.de;echo'
|
||||
alias pdf14='gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile='
|
||||
alias scat='source-highlight -o STDOUT -f esc -i'
|
||||
function rot13 {
|
||||
if [ $# -eq 9 ] ; then
|
||||
echo "Usage: $0 <file|text>"
|
||||
exit 1;
|
||||
elif [ $# -eq 1 -a -f $1 -a -r $1 ]; then
|
||||
cat $1 | tr '[N-ZA-Mn-za-m5-90-4]' '[A-Za-z0-9]'
|
||||
else
|
||||
echo $* | tr '[N-ZA-Mn-za-m5-90-4]' '[A-Za-z0-9]'
|
||||
fi
|
||||
}
|
||||
function wim() {
|
||||
if [ -n "$1" ] ; then
|
||||
curl -s "$1"|elinks -dump -dump-charset UTF-8|vim -
|
||||
else
|
||||
echo "Usage:"
|
||||
echo " $0 <URL>"
|
||||
fi
|
||||
}
|
||||
function expand() {
|
||||
wget -S -O /dev/null $1 2>&1 |grep "^\s*Location"
|
||||
}
|
||||
function bigf() {
|
||||
find . -type f -printf '%20s %p\n' | sort -nr|head -n250 | cut -b22- | tr '\n' '\000' | xargs -0 ls -laSrh
|
||||
}
|
||||
function htmltitle() {
|
||||
if [ -n "$1" ] ; then
|
||||
curl -s -S -L "$1" 2> /dev/null|html2 2> /dev/null |sed -rn 's_^/html/head/title=(.*)$_\1_p'
|
||||
else
|
||||
echo "Usage: $0 <url>"
|
||||
fi
|
||||
}
|
||||
function printtime() {
|
||||
perl -le 'my $t='$1'; my $s=$t%60; my $m=($t-$s)/60%60; my $h=($t-$m*60-$s)/3600%24; my $d=($t-$h*3600-$m*60-$s)/86400; printf("%d, %02d:%02d:%02d\n",$d,$h,$m,$s);'
|
||||
}
|
||||
function unix() {
|
||||
php -r "date_default_timezone_set('Europe/Berlin');echo date('Y-m-d, H:i:s',$1).PHP_EOL;"
|
||||
}
|
||||
function 0l3() {
|
||||
curl "http://0l3.de/api/create.plain/$1"
|
||||
}
|
||||
cp_p()
|
||||
{
|
||||
strace -q -ewrite cp -- "${1}" "${2}" 2>&1 \
|
||||
| awk '{
|
||||
count += $NF
|
||||
if (count % 10 == 0) {
|
||||
percent = count / total_size * 100
|
||||
printf "%3d%% [", percent
|
||||
for (i=0;i<=percent;i++)
|
||||
printf "="
|
||||
printf ">"
|
||||
for (i=percent;i<100;i++)
|
||||
printf " "
|
||||
printf "]\r"
|
||||
}
|
||||
}
|
||||
END { print "" }' total_size=$(stat -c '%s' "${1}") count=0
|
||||
}
|
||||
|
||||
# systemctl
|
||||
command -v systemctl > /dev/null && {
|
||||
alias start='sudo systemctl start'
|
||||
alias stop='sudo systemctl stop'
|
||||
alias restart='sudo systemctl restart'
|
||||
alias reload='sudo systemctl reload'
|
||||
alias status='sudo systemctl status'
|
||||
}
|
||||
# vim: ft=zsh :
|
@ -0,0 +1,44 @@
|
||||
eval "$(gnome-keyring-daemon --start --daemonize --components=pkcs11,secrets,ssh,gpg)"
|
||||
|
||||
# aliases
|
||||
|
||||
alias fuckflash='mplayer `\ls -lv /proc/$(pgrep -nf plugin)/fd/* | grep Fl | awk "{print \\$9;}" | tail -n 1`'
|
||||
alias dumpflash='mplayer `\ls -lv /proc/$(pgrep -nf plugin)/fd/* | grep Fl | awk "{print \\$9;}" | tail -n 1` -dumpstream -dumpfile'
|
||||
alias o='okular'
|
||||
alias mg="history|egrep '( m )|( m6 )'|grep -v grep|tail"
|
||||
alias m6='mplayer -channels 6'
|
||||
alias m='mplayer'
|
||||
alias p='mirage'
|
||||
alias flash=' clive --stream-exec="mplayer -really-quiet %i" --stream=10'
|
||||
alias speed='xmodmap ~/.speedswapper'
|
||||
|
||||
|
||||
function mac() {
|
||||
if [ ! $# -eq 2 ] ; then
|
||||
echo "Usagen: $0 <interface> <mac>"
|
||||
fi
|
||||
MAC="$2"
|
||||
if [ "$(echo "$MAC"|sed -rn '/^([0-9a-f]{2}:){5}[0-9a-f]{2}$/p'|wc -l)" -eq 1 ] ; then
|
||||
sudo su -c "ifconfig $1 down;ifconfig $1 hw ether '$MAC';ifconfig $1 up"
|
||||
else
|
||||
echo no valid mac!
|
||||
fi
|
||||
}
|
||||
function offlineimap-solve-uuid-problem() {
|
||||
if [ $# -ne 2 ] ; then
|
||||
echo "Usage:"
|
||||
echo " $0 <account> <folder>"
|
||||
fi
|
||||
ACCOUNT="$1"
|
||||
FOLDER="$2"
|
||||
FOLDER2="$(echo $FOLDER|tr '.' '/')"
|
||||
if [ -d ".Maildir/$ACCOUNT/$FOLDER2" -a -f ".offlineimap/Account-$ACCOUNT/LocalStatus-sqlite/$FOLDER" -a -f ".offlineimap/Repository-$ACCOUNT-local/FolderValidity/$FOLDER" ] ; then
|
||||
rm -rv \
|
||||
".Maildir/$ACCOUNT/$FOLDER2" \
|
||||
".offlineimap/Account-$ACCOUNT/LocalStatus-sqlite/$FOLDER" \
|
||||
".offlineimap/Repository-$ACCOUNT-local/FolderValidity/$FOLDER"
|
||||
else
|
||||
echo "File or folder not found!"
|
||||
fi
|
||||
}
|
||||
# vim: ft=zsh :
|
@ -0,0 +1,42 @@
|
||||
# disable xoff (ctrl+s)
|
||||
stty ixany
|
||||
stty ixoff -ixon
|
||||
|
||||
BROWSER='elinks'
|
||||
|
||||
alias maillog='sudo journalctl -u dovecot -u postgrey -u postfix -u opendkim'
|
||||
alias chk-starttls='openssl s_client -starttls smtp -crlf -connect'
|
||||
|
||||
function dist_file {
|
||||
if [ "$1" = "cp" ] ; then
|
||||
cmd="cp"
|
||||
elif [ "$1" = "mv" ] ; then
|
||||
cmd="mv"
|
||||
else
|
||||
echo unknown action
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -f "$2" ] ; then
|
||||
echo no such file
|
||||
exit 1
|
||||
fi
|
||||
ADDR="$(pwgen -s 16 1)"
|
||||
DIR="/www/t-battermann.de/main/files/$ADDR"
|
||||
while [ -d "$DIR" ] ; do
|
||||
ADDR="$(pwgen -s 16 1)"
|
||||
DIR="/www/t-battermann.de/main/files/$ADDR"
|
||||
done
|
||||
mkdir "$DIR"
|
||||
bn=$(basename $2)
|
||||
$cmd "$2" "$DIR/$bn"
|
||||
chmod 644 "$DIR/$bn"
|
||||
echo "Link: https://t-battermann.de/files/$ADDR/$bn"
|
||||
}
|
||||
function cpwww {
|
||||
dist_file cp "$1"
|
||||
}
|
||||
function mvwww {
|
||||
dist_file mv "$1"
|
||||
}
|
||||
|
||||
# vim: ft=zsh :
|
@ -0,0 +1,14 @@
|
||||
function gc {
|
||||
if [ $? -gt 0 ] ; then
|
||||
git commit -a -m "$*"
|
||||
else
|
||||
git commit -a
|
||||
fi
|
||||
}
|
||||
alias gp='git pull'
|
||||
alias gu='git push'
|
||||
alias gadd='git add'
|
||||
alias gitdiff='git log|grep commit|cut -d " " -f2|head -n 2|xargs -n 2 git diff -R|vimpager'
|
||||
function gum() {
|
||||
git submodule foreach git pull origin master && git submodule update
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
# open files in programms
|
||||
|
||||
alias -s dia=dia
|
||||
alias -s dvi=okular
|
||||
alias -s eps=okular
|
||||
alias -s pdf=okular
|
||||
|
||||
|
||||
# text files
|
||||
alias -s cpp=vim
|
||||
alias -s css=vim
|
||||
alias -s csv=vim
|
||||
alias -s c=vim
|
||||
alias -s html=vim
|
||||
alias -s htm=vim
|
||||
alias -s h=vim
|
||||
alias -s java=vim
|
||||
alias -s js=vim
|
||||
alias -s php=vim
|
||||
alias -s pl=vim
|
||||
alias -s py=vim
|
||||
alias -s sql=vim
|
||||
alias -s sublime-project=vim
|
||||
alias -s tex=vim
|
||||
alias -s txt=vim
|
||||
alias -s xml=vim
|
||||
|
||||
alias -s markdown=vim
|
||||
alias -s md=vim
|
||||
alias -s mkd=vim
|
||||
|
||||
# office
|
||||
alias -s xls=libreoffice
|
||||
alias -s xlsx=libreoffice
|
||||
alias -s doc=libreoffice
|
||||
alias -s docx=libreoffice
|
||||
alias -s ppt=libreoffice
|
||||
alias -s pptx=libreoffice
|
||||
alias -s mpp=libreoffice
|
||||
alias -s rtf=libreoffice
|
||||
alias -s odt=libreoffice
|
||||
alias -s ods=libreoffice
|
||||
|
||||
# video files
|
||||
alias -s avi=mplayer
|
||||
alias -s flv=mplayer
|
||||
alias -s mkv=mplayer
|
||||
alias -s mp4=mplayer
|
||||
alias -s mpeg=mplayer
|
||||
alias -s mpg=mplayer
|
||||
alias -s swf=mplayer
|
||||
alias -s vob=mplayer
|
||||
alias -s wmv=mplayer
|
||||
|
||||
# audio files
|
||||
alias -s aac=mplayer
|
||||
alias -s flac=mplayer
|
||||
alias -s mp2=mplayer
|
||||
alias -s mp3=mplayer
|
||||
alias -s ogg=mplayer
|
||||
alias -s wav=mplayer
|
||||
alias -s wma=mplayer
|
||||
|
||||
|
||||
# images
|
||||
alias -s bmp=mirage
|
||||
alias -s jpeg=mirage
|
||||
alias -s jpg=mirage
|
||||
alias -s png=mirage
|
||||
alias -s tiff=mirage
|
||||
alias -s tif=mirage
|
||||
alias -s xcf=gimp
|
||||
|
||||
|
||||
# vim: set ft=zsh :
|
@ -0,0 +1,19 @@
|
||||
export PATH="$HOME/.rbenv/shims:$HOME/.rbenv/plugins/ruby-build/bin:$HOME/.rbenv/bin:${PATH}"
|
||||
export RBENV_SHELL=zsh
|
||||
source "$HOME/.rbenv/completions/rbenv.zsh"
|
||||
rbenv rehash 2>/dev/null
|
||||
rbenv() {
|
||||
local command
|
||||
command="$1"
|
||||
if [ "$#" -gt 0 ]; then
|
||||
shift
|
||||
fi
|
||||
|
||||
case "$command" in
|
||||
rehash|shell)
|
||||
eval "`rbenv "sh-$command" "$@"`";;
|
||||
*)
|
||||
command rbenv "$command" "$@";;
|
||||
esac
|
||||
}
|
||||
# vim: ft=zsh :
|
@ -0,0 +1,161 @@
|
||||
# prompts for zsh
|
||||
|
||||
setopt ALL_EXPORT
|
||||
|
||||
autoload colors zsh/terminfo
|
||||
|
||||
if [[ "$terminfo[colors]" -ge 8 ]]; then
|
||||
colors
|
||||
fi
|
||||
|
||||
PR_NO_COLOR="$terminfo[sgr0]"
|
||||
|
||||
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE BLACK; do
|
||||
eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
|
||||
eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
|
||||
eval BG_$color='%{$terminfo[bold]$bg[${(L)color}]%}'
|
||||
eval BG_LIGHT_$color='%{$bg[${(L)color}]%}'
|
||||
(( count = $count + 1 ))
|
||||
done
|
||||
PR_NO_COLOR="%{$terminfo[sgr0]%}"
|
||||
|
||||
PR_USER_COLOR=$PR_CYAN
|
||||
if [[ "`whoami`" = "root" ]]; then
|
||||
PR_USER_COLOR=$PR_RED
|
||||
else
|
||||
PR_USER_COLOR=$PR_LIGHT_GREEN
|
||||
fi
|
||||
|
||||
function precmd {
|
||||
# let's get the current get branch that we are under
|
||||
# ripped from /etc/bash_completion.d/git from the git devs
|
||||
git_ps1 () {
|
||||
if which git > /dev/null; then
|
||||
local g="$(git rev-parse --git-dir 2>/dev/null)"
|
||||
if [ -n "$g" ]; then
|
||||
local r
|
||||
local b
|
||||
local date=$(git log --pretty=format:%cd --date=short -n1)
|
||||
local v=$(git describe --tags --always)
|
||||
if [ -d "$g/rebase-apply" ]; then
|
||||
if test -f "$g/rebase-apply/rebasing"; then
|
||||
r="|REBASE"
|
||||
elif test -f "$g/rebase-apply/applying"; then
|
||||
r="|AM"
|
||||
else
|
||||
r="|AM/REBASE"
|
||||
fi
|
||||
b="$(git symbolic-ref HEAD 2>/dev/null)"
|
||||
elif [ -f "$g/rebase-merge/interactive" ]; then
|
||||
r="|REBASE-i"
|
||||
b="$(cat "$g/rebase-merge/head-name")"
|
||||
elif [ -d "$g/rebase-merge" ]; then
|
||||
r="|REBASE-m"
|
||||
b="$(cat "$g/rebase-merge/head-name")"
|
||||
elif [ -f "$g/MERGE_HEAD" ]; then
|
||||
r="|MERGING"
|
||||
b="$(git symbolic-ref HEAD 2>/dev/null)"
|
||||
else
|
||||
if [ -f "$g/BISECT_LOG" ]; then
|
||||
r="|BISECTING"
|
||||
fi
|
||||
if ! b="$(git symbolic-ref HEAD 2>/dev/null)"; then
|
||||
if ! b="$(git describe --exact-match HEAD 2>/dev/null)"; then
|
||||
b="$(cut -c1-7 "$g/HEAD")..."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -n "$1" ]; then
|
||||
printf "$1·%s·%s" "${b##refs/heads/}$r" "$date" "$v"
|
||||
else
|
||||
printf "%s·%s·%s" "${b##refs/heads/}$r" "$date" "$v"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
printf ""
|
||||
fi
|
||||
}
|
||||
|
||||
GITBRANCH="$(git_ps1)"
|
||||
if [ -n "$GITBRANCH" ] ; then
|
||||
GITBRANCH=" g:$GITBRANCH"
|
||||
fi
|
||||
|
||||
# The following 9 lines of code comes directly from Phil!'s ZSH prompt
|
||||
# http://aperiodic.net/phil/prompt/
|
||||
local TERMWIDTH
|
||||
(( TERMWIDTH = ${COLUMNS} - 1 ))
|
||||
|
||||
#local PROMPTSIZE=${#${(%):--- %D{%R.%S %a %b %d %Y}\! }}
|
||||
local PROMPTSIZE=${#${(%):----%n-%m----%D{%Y-%m-%d %H:%M}----}}
|
||||
|
||||
local PWDSIZE=${#${(%):-%~}}
|
||||
|
||||
if [[ "$PROMPTSIZE + $PWDSIZE" -gt $TERMWIDTH ]]; then
|
||||
(( PR_PWDLEN = $TERMWIDTH - $PROMPTSIZE ))
|
||||
fi
|
||||
|
||||
# set a simple variable to show when in screen
|
||||
if [[ -n "${WINDOW}" ]]; then
|
||||
SCREEN=" S:${WINDOW}"
|
||||
else
|
||||
SCREEN=""
|
||||
fi
|
||||
|
||||
# check if jobs are executing
|
||||
if [[ $(jobs | wc -l) -gt 0 ]]; then
|
||||
JOBS=" J:%j"
|
||||
else
|
||||
JOBS=""
|
||||
fi
|
||||
|
||||
# I want to know my battery percentage when running on battery power
|
||||
if which acpi &> /dev/null; then
|
||||
local BATTSTATE="$(acpi -b)"
|
||||
local BATTPRCNT="$(echo ${BATTSTATE[(w)4]}|sed -r 's/(^[0-9]+).*/\1/')"
|
||||
if [[ -z "${BATTPRCNT}" ]]; then
|
||||
PR_BATTERY=""
|
||||
elif [[ "${BATTPRCNT}" -lt 20 ]]; then
|
||||
PR_BATTERY="${PR_BOLD_RED}B:${BATTPRCNT}%%"
|
||||
elif [[ "${BATTPRCNT}" -lt 50 ]]; then
|
||||
PR_BATTERY="${PR_BOLD_YELLOW}B:${BATTPRCNT}%%"
|
||||
else
|
||||
PR_BATTERY="B:${BATTPRCNT}%%"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# If I am using vi keys, I want to know what mode I'm currently using.
|
||||
# zle-keymap-select is executed every time KEYMAP changes.
|
||||
# From http://zshwiki.org/home/examples/zlewidgets
|
||||
zle-keymap-select() {
|
||||
VIMODE="${${KEYMAP/vicmd/ vim:command}/(main|viins)}"
|
||||
RPROMPT2="${PR_BOLD_BLUE}${VIMODE}"
|
||||
zle reset-prompt
|
||||
}
|
||||
|
||||
zle -N zle-keymap-select
|
||||
|
||||
|
||||
function setprompt() {
|
||||
setopt prompt_subst
|
||||
IS_SSH_CONN=""
|
||||
if [ -n "$SSH_CONNECTION" ] ; then
|
||||
IS_SSH_CONN=" ${PR_RED}⚡$PR_NO_COLOR "
|
||||
fi
|
||||
PROMPT="$PR_LIGHT_CYAN┌─[ $PR_USER_COLOR%n$PR_WHITE@$PR_GREEN%m$PR_NO_COLOR $PR_LIGHT_CYAN]─($PR_NO_COLOR$PR_LIGHT_YELLOW%D{%Y-%m-%d %H:%M}$PR_NO_COLOR$PR_LIGHT_CYAN)─→ \
|
||||
$PR_NO_COLOR$PR_LIGHT_YELLOW%\${PR_PWDLEN}<...<%~%<<\
|
||||
$PR_NO_COLOR\
|
||||
|
||||
$PR_LIGHT_CYAN├─(\${IS_SSH_CONN}$PR_NO_COLOR\${PR_BATTERY}\${SCREEN}\${JOBS}%(?.. ${PR_RED}E:%?${PR_NO_COLOR} )\
|
||||
\${GITBRANCH}$PR_LIGHT_CYAN)$PR_NO_COLOR\
|
||||
|
||||
${PR_LIGHT_CYAN}└─[%(!.#.$)]${PR_NO_COLOR} "
|
||||
}
|
||||
setprompt
|
||||
PS2="$PR_LIGHT_CYAN└─[$PR_NO_COLOR $PR_WHITE%_$PR_NO_COLOR $PR_LIGHT_CYAN]──→$PR_NO_COLOR "
|
||||
|
||||
PS3="$PR_LIGHT_CYAN╶─[$PR_NO_COLOR?#$PR_LIGHT_CYAN]──→$PR_NO_COLOR "
|
||||
PS4="$fg[${cyan}]├──→$terminfo[sgr0] "
|
||||
|
||||
# vim: ft=zsh :
|
@ -0,0 +1,99 @@
|
||||
# Set name of the theme to load.
|
||||
# Look in ~/.oh-my-zsh/themes/
|
||||
# Optionally, if you set this to "random", it'll load a random theme each
|
||||
# time that oh-my-zsh is loaded.
|
||||
#ZSH_THEME="mortalscumbag"
|
||||
#ZSH_THEME="af-magic"
|
||||
ZSH_THEME="../../thomasba"
|
||||
|
||||
# Uncomment the following line to use case-sensitive completion.
|
||||
# CASE_SENSITIVE="true"
|
||||
|
||||
# Uncomment the following line to disable bi-weekly auto-update checks.
|
||||
# DISABLE_AUTO_UPDATE="true"
|
||||
|
||||
# Uncomment the following line to change how often to auto-update (in days).
|
||||
# export UPDATE_ZSH_DAYS=13
|
||||
|
||||
# Uncomment the following line to disable colors in ls.
|
||||
# DISABLE_LS_COLORS="true"
|
||||
|
||||
# Uncomment the following line to disable auto-setting terminal title.
|
||||
# DISABLE_AUTO_TITLE="true"
|
||||
|
||||
# Uncomment the following line to enable command auto-correction.
|
||||
ENABLE_CORRECTION="true"
|
||||
|
||||
# Uncomment the following line to display red dots whilst waiting for completion.
|
||||
COMPLETION_WAITING_DOTS="true"
|
||||
|
||||
# Uncomment the following line if you want to disable marking untracked files
|
||||
# under VCS as dirty. This makes repository status check for large repositories
|
||||
# much, much faster.
|
||||
# DISABLE_UNTRACKED_FILES_DIRTY="true"
|
||||
|
||||
# Uncomment the following line if you want to change the command execution time
|
||||
# stamp shown in the history command output.
|
||||
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
|
||||
HIST_STAMPS="yyyy-mm-dd"
|
||||
|
||||
# Would you like to use another custom folder than $ZSH/custom?
|
||||
# ZSH_CUSTOM=/path/to/new-custom-folder
|
||||
|
||||
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
|
||||
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
|
||||
# Example format: plugins=(rails git textmate ruby lighthouse)
|
||||
# Add wisely, as too many plugins slow down shell startup.
|
||||
plugins=(git docker rand-quote sublime sudo web-search pass)
|
||||
|
||||
# User configuration
|
||||
|
||||
export PATH="$PATH:$HOME/.gem/ruby/2.1.0/bin"
|
||||
# export MANPATH="/usr/local/man:$MANPATH"
|
||||
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
source $HOME/.zsh/programs
|
||||
source $HOME/.zsh/commands
|
||||
case "$MTYPE" in
|
||||
"PC")
|
||||
source $HOME/.zsh/commands-pc
|
||||
;;
|
||||
"SERVER")
|
||||
source $HOME/.zsh/commands-server
|
||||
;;
|
||||
esac
|
||||
if [ -f "$HOME/.zsh/rbenv" -a -d "$HOME/.rbenv" ] ; then
|
||||
source $HOME/.zsh/rbenv
|
||||
fi
|
||||
if [ -d "$HOME/bin" ] ; then
|
||||
export PATH="$PATH:$HOME/bin"
|
||||
fi
|
||||
|
||||
source $HOME/.zsh/git-commands
|
||||
# You may need to manually set your language environment
|
||||
# export LANG=en_US.UTF-8
|
||||
|
||||
# Preferred editor for local and remote sessions
|
||||
# if [[ -n $SSH_CONNECTION ]]; then
|
||||
export EDITOR='vim'
|
||||
# else
|
||||
# export EDITOR='mvim'
|
||||
# fi
|
||||
|
||||
# Compilation flags
|
||||
# export ARCHFLAGS="-arch x86_64"
|
||||
|
||||
# Set personal aliases, overriding those provided by oh-my-zsh libs,
|
||||
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
|
||||
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
|
||||
# For a full list of active aliases, run `alias`.
|
||||
#
|
||||
# Example aliases
|
||||
alias zshconfig="vim ~/.zsh"
|
||||
alias ohmyzsh="vim ~/.zsh/oh-my-zsh"
|
||||
|
||||
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
|
||||
zstyle ':completion:*:*:kill:*:processes' command 'ps --forest -A -o pid,user,cmd'
|
||||
zstyle ':completion:*:processes-names' command 'ps axho command'
|
||||
|
||||
# vim: ft=zsh :
|
Loading…
Reference in new issue