starting things slowly...

This commit is contained in:
fschl 2015-10-24 00:57:07 +02:00
parent 67242630d6
commit adfdabc232
8 changed files with 322 additions and 0 deletions

14
.aliases Normal file
View File

@ -0,0 +1,14 @@
alias .. cd ..
alias ... cd ../..
alias .... cd ../../..
alias ..... cd ../../../..
alias ll='ls -ahlF'
alias la='ls -Ah'
alias l='ls -CF'
alias dps='docker ps -a'
alias di='docker images'
alias dip="docker inspect -f '{{ .NetworkSettings.IPAddress }}'" # call with <container name> or ID
alias dih="docker inspect -f '{{ .Config.Hostname }}'" # call with <container name> or ID
alias dstats="docker stats "'$(sudo docker ps -aq)' # shows stats thingy for all containers

115
.bashrc Normal file
View File

@ -0,0 +1,115 @@
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# allow docker to use X
xhost +local:root
# Load the shell dotfiles, and then some:
# * ~/.path can be used to extend `$PATH`.
# * ~/.extra can be used for other settings you dont want to commit.
for file in ~/.{aliases,bash_prompt,functions,path,extra,exports,dockerfunc}; do
[[ -r "$file" ]] && [[ -f "$file" ]] && source "$file"
done
unset file
# Case-insensitive globbing (used in pathname expansion)
shopt -s nocaseglob
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1="\[\e[01;36m\]\u\[\e[0m\]\[\e[00;37m\]@\[\e[0m\]\[\e[01;33m\]\h\[\e[0m\]\[\e[00;36m\][\w]\[\e[0m\]\[\e[01;31m\]\\$\[\e[0m\]\[\e[00;37m\] \[\e[0m\]"
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
export GOROOT=/usr/local/go
export GOPATH=~/projects/go-projects
export PATH=${PATH}:${GOROOT}/bin:${GOPATH}/bin

120
.dockerfunc Normal file
View File

@ -0,0 +1,120 @@
#!/bin/bash
# Bash wrappers for docker run commands
# inspired by https://github.com/jfrazelle/dotfiles/ <3
#
# Helper Functions
#
dcleanup() {
docker rm -v $(docker ps --filter status=exited -q 2>/dev/null) 2>/dev/null
docker rmi $(docker images --filter dangling=true -q 2>/dev/null) 2>/dev/null
}
del_stopped() {
local name=$1
local state=$(docker inspect --format "{{.State.Running}}" $name 2>/dev/null)
if [[ "$state" == "false" ]]; then
docker rm $name
fi
}
relies_on() {
local containers=$@
for container in $containers; do
local state=$(docker inspect --format "{{.State.Running}}" $container 2>/dev/null)
if [[ "$state" == "false" ]] || [[ "$state" == "" ]]; then
echo "$container is not running, starting it for you."
$container
fi
done
}
chrome() {
# add flags for proxy if passed
local proxy=
local map=
local args=$@
del_stopped chrome
# one day remove /etc/hosts bind mount when effing
# overlay support inotify, such bullshit
docker run -d \
--memory 3gb \
--net host \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
-v $HOME/Downloads:/root/Downloads \
-v $HOME/Pictures:/root/Pictures \
-v $HOME/Torrents:/root/Torrents \
-v $HOME/.chrome:/data \
-v /dev/shm:/dev/shm \
-v /etc/hosts:/etc/hosts \
--device /dev/snd \
--device /dev/dri \
--device /dev/video0 \
--device /dev/usb \
--device /dev/bus/usb \
--group-add audio \
--group-add video \
--name chrome \
fschl/chrome --user-data-dir=/data --force-device-scale-factor=1 \
--proxy-server="$proxy" --host-resolver-rules="$map" "$args"
}
eclipse() {
del_stopped eclipse
docker run -it --rm \
--net host \
-v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY \
-v $HOME/projects/java/workspace:/root/workspace \
-v $HOME/Documents/WHZ/PTI615-OOSE:/root/workspace2 \
-v $HOME/.eclipse/plugins:/opt/eclipse/plugins \
-v $HOME/.eclipse/configuration:/opt/eclipse/configuration \
--name eclipse \
fschl/eclipse-jdk7:latest
}
pulseaudio() {
del_stopped pulseaudio
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
--device /dev/snd \
-p 4713:4713 \
--restart always \
-v /var/run/dbus:/var/run/dbus \
-v /etc/machine-id:/etc/machine-id \
--name pulseaudio \
fschl/pulseaudio
}
skype() {
del_stopped skype
docker run -d \
-v /dev/shm:/dev/shm \
-v /etc/machine-id:/etc/machine-id \
-v /run/user/1000/pulse:/run/user/1000/pulse \
-v /var/lib/dbus:/var/lib/dbus \
-v ~/.pulse:/root/.pulse \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
--device /dev/video0 \
--device /dev/snd \
--name skype \
--net host \
fschl/skype
}
bro() {
docker run -it --rm \
fschl/bropages \
bro
}

7
.gitconfig Normal file
View File

@ -0,0 +1,7 @@
[user]
name = fschl
email = friedaar@gmx.de
[credential]
helper = cache
[color]
ui = true

22
.profile Normal file
View File

@ -0,0 +1,22 @@
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi

27
.tmux.conf Normal file
View File

@ -0,0 +1,27 @@
unbind C-b
set -g prefix M-a
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
set-window-option -g window-status-current-bg yellow
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf
# quick pane cycling
unbind M-s
bind -n M-s select-pane -t :.+
# pane splitting like in emacs
unbind M-2
bind -n M-2 split-window -h
unbind M-4
bind -n M-4 split-window
#unbind C-W
#bind -n C-W confirm-before -p "kill-pane #W? (y/n)" kill-window

14
Makefile Normal file
View File

@ -0,0 +1,14 @@
.PHONY: all default dotfiles install
all: dotfiles
default: install
install: all
dotfiles:
# add aliases for dotfiles
for file in $(shell find $(CURDIR) -name ".*" -not -name ".gitignore" -not -name ".git" -not -name ".*.swp"); do \
f=$$(basename $$file); \
ln -sfn $$file $(HOME)/$$f; \
done

View File

@ -1 +1,4 @@
# dotfiles # dotfiles
some stuff that makes my linux life more portable. uses containers. strongly inspired by awesome work of @jfrazelle and @jpetazzo <3