diff --git a/bin/exif_rename b/bin/exif_rename new file mode 100755 index 0000000..5f432de --- /dev/null +++ b/bin/exif_rename @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +exiftool \ + -P \ + -d '%Y-%m-%d-%H-%M' \ + '-filename<$DateTimeOriginal%-03c.%e' \ + '-filename<$DateTimeOriginal $Title%-03c.%e' \ + "$@" diff --git a/bin/exif_set_title b/bin/exif_set_title new file mode 100755 index 0000000..a2ac0b3 --- /dev/null +++ b/bin/exif_set_title @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +for VIDEO_FNAME in "$@" +do + TITLE=$(exiftool -s -s -s -XMP:Title "$VIDEO_FNAME") + + echo "$VIDEO_FNAME" + + # Play video + totem "$VIDEO_FNAME" 2> /dev/null + + # Ask user for new values + read -e -p "Title [$TITLE]: " TITLE + + # Update EXIF if result wasn't blank + if [ -n "${TITLE}" ]; then + exiftool -overwrite_original \ + -XMP:Title="$TITLE" \ + "$VIDEO_FNAME" + fi +done diff --git a/bin/git-amend b/bin/git-amend index f5a7e87..b12b9bc 100755 --- a/bin/git-amend +++ b/bin/git-amend @@ -2,4 +2,4 @@ # # Use the last commit message and amend your stuffs. -git commit --amend -C HEAD +git commit --amend --no-verify -C HEAD diff --git a/bin/meld b/bin/meld deleted file mode 120000 index 3a6e292..0000000 --- a/bin/meld +++ /dev/null @@ -1 +0,0 @@ -/home/knub/Programme/meld-3.14.2/bin/meld \ No newline at end of file diff --git a/bin/run.zsh-run b/bin/run.zsh-run index 8fe9adc..6cabcee 100644 --- a/bin/run.zsh-run +++ b/bin/run.zsh-run @@ -1 +1,2 @@ export PATH="$PATH:$DOTFILES/bin" +export PATH="$PATH:/home/knub/.local/bin" diff --git a/dircolors/dircolors.symlink b/dircolors/dircolors.symlink index 5469fc4..e2d29f2 100644 --- a/dircolors/dircolors.symlink +++ b/dircolors/dircolors.symlink @@ -138,6 +138,7 @@ EIGHTBIT 1 ### By file type +OTHER_WRITABLE 00 # global default NORMAL 00 # normal file diff --git a/git/aliases.zsh-run b/git/aliases.zsh-run index 6fa9213..19c3c28 100644 --- a/git/aliases.zsh-run +++ b/git/aliases.zsh-run @@ -3,12 +3,14 @@ alias glog="git log --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C alias ga="git add" alias ga.="git add ." alias gam='git commit --amend' -alias gp='git push origin HEAD -q' +alias gp='git push -u origin HEAD -q' alias gpf='gp -f' +alias gpt='git push -u -q origin $(git rev-parse --abbrev-ref HEAD)' +alias gpd='git push origin --delete' alias gl='git --no-pager log --decorate=short --pretty="format:HEAD %C(yellow)%H%n%CresetAuthor: %an <%ae>%nDate: %ai, %ar%nCommit: %ci %cr%n%n%s%n" -n1' alias glr='git pull --rebase --quiet && gl' alias grc='git rebase --continue' -alias gfro='git fetch -q && git reset --hard origin/$(git name-rev --name-only HEAD) && gl' +alias gfro='git fetch -q && git reset --hard origin/$(git branch --show-current) && gl' alias gd='git diff' alias gds='git diff --staged' alias gc='git commit' @@ -16,14 +18,48 @@ alias gcempty='git commit -m "" --allow-empty-message' alias gca='git commit -a' alias gco='git checkout' alias gco.='git checkout .' -alias gcom='git checkout master' + +git_checkout_main_or_master() { + if git rev-parse --verify master &>/dev/null; then + git checkout master + else + git checkout main + fi +} +alias gcom='git_checkout_main_or_master' alias gcod='git checkout develop' alias gb='git branch' alias gs='git status -sb' +alias grpo='git remote prune origin' +alias grh='git reset HEAD' alias gt='git stash' +alias gtl='git stash list' +alias gtd='git stash drop' +alias gbd='git branch -D' alias gtlrt='git stash -q && git pull --rebase --quiet && gl && git stash pop -q' -alias gcaap='git add . && git-amend && gp -f' # git commit all amend push +alias gcaapf='git add . && git-amend && gp -f' # git commit all amend push force alias gassumeunchanged='git ls-files -v | grep "^[[:lower:]]"' + +function gpm() { + # git post merge cleanup + BRANCH=$(git rev-parse --abbrev-ref HEAD) + + if [[ $# -ne 0 ]] + then + gco $1 + else + gcom + fi + glr + gbd $BRANCH + grpo +} +function gbackup() { + # creates backup branch + BRANCH=$(git rev-parse --abbrev-ref HEAD) + git checkout -b $BRANCH-backup + git checkout $BRANCH +} function gri() { git rebase -i "HEAD~$1" } @@ -33,3 +69,6 @@ function vimgitexclude() { function vimgitignore() { vim + $(git rev-parse --show-toplevel)/.gitignore } +function vimgitconfig() { + vim + $(git rev-parse --show-toplevel)/.git/config +} diff --git a/git/gitconfig.symlink b/git/gitconfig.symlink index 6d6606f..7d4c6aa 100644 --- a/git/gitconfig.symlink +++ b/git/gitconfig.symlink @@ -1,6 +1,6 @@ [user] name = Stefan Bunk - email = stefan.bunk@googlemail.com + email = stefan@merantix.com [alias] count = !git shortlog -sn [color] diff --git a/installs b/installs index 007e486..363dada 100644 --- a/installs +++ b/installs @@ -42,3 +42,5 @@ Unison # Fedora font rendering infinality + +mediainfo diff --git a/machine-based/merantix/aliases.zsh-run b/machine-based/merantix/aliases.zsh-run new file mode 100644 index 0000000..de7a926 --- /dev/null +++ b/machine-based/merantix/aliases.zsh-run @@ -0,0 +1,30 @@ + +alias cil="gcloud compute instances list" +alias cid="gcloud compute instances delete" +alias cista="gcloud compute instances start" +alias cisto="gcloud compute instances stop" + +function cid() { + gcloud compute instances list | grep $1 | awk '{print $1}' | xargs -I {} -P 100 gcloud compute instances delete {} --quiet +} + +alias dipython="drun ipython -i /merantix_core/developer_env/ipython_setup.py" + +function vimgithook() { + vim + $(git rev-parse --show-toplevel)/.git/hooks/pre-commit +} + +function delete_branches() { + git branch --list 'benjamin-*' | xargs -r git branch -D + git branch --list 'christian-*' | xargs -r git branch -D + git branch --list 'dominik_*' | xargs -r git branch -D + git branch --list 'filippo-*' | xargs -r git branch -D + git branch --list 'gunnar-*' | xargs -r git branch -D + git branch --list 'john-*' | xargs -r git branch -D + git branch --list 'john_*' | xargs -r git branch -D + git branch --list 'jack-*' | xargs -r git branch -D + git branch --list 'jacek-*' | xargs -r git branch -D + git branch --list 'markus-*' | xargs -r git branch -D + git branch --list 'robert-*' | xargs -r git branch -D + git branch --list 'thijs-*' | xargs -r git branch -D +} diff --git a/machine-based/merantix/helper.zsh-run b/machine-based/merantix/helper.zsh-run new file mode 100644 index 0000000..a306b0c --- /dev/null +++ b/machine-based/merantix/helper.zsh-run @@ -0,0 +1,4 @@ +function merantix_data_sync_with_nautilus() { + merantix_data_sync $1 + nautilus ~/merantix/core/data/$1 +} diff --git a/machine-based/merantix/homes-and-paths.zsh-run b/machine-based/merantix/homes-and-paths.zsh-run index 3de444a..81fc336 100644 --- a/machine-based/merantix/homes-and-paths.zsh-run +++ b/machine-based/merantix/homes-and-paths.zsh-run @@ -1 +1,8 @@ -export PYTHONPATH="/home/knub/Repositories/merantix:" +export CLOUDSDK_PYTHON=python3 + +LYNX_DB_URL=postgresql://read_only:UO%EH^P%t4nkRd%W@cloudproxy:5433/lynx +LYNX_DB_ENV="local" + +LYNX_DB_HOST="10.0.0.251" +LYNX_DB_PROXY_USER="ml_access" +LYNX_DB_PROXY_HOST="80.158.3.226" diff --git a/machine-based/merantix/navigation.zsh-run b/machine-based/merantix/navigation.zsh-run index 8d05d39..9cb9627 100644 --- a/machine-based/merantix/navigation.zsh-run +++ b/machine-based/merantix/navigation.zsh-run @@ -1 +1,12 @@ -alias cdmerantix="cd ~/Repositories/merantix" +alias cdcore="cd ~/merantix/core" +alias cdpp="cd /merantix_core/data/mx-healthcare-derived/preprocessed" +alias cdexperiments="cd /merantix_core/data/mx-healthcare-derived/experiments" + +function cddata() { + if [ "$#" -eq 0 ] + then + cd ~/merantix/core/data + else + cd ~/merantix/core/data/$1 + fi +} diff --git a/machine-based/thinkpad/homes-and-paths.zsh-run b/machine-based/thinkpad/homes-and-paths.zsh-run index 45b240f..e69de29 100644 --- a/machine-based/thinkpad/homes-and-paths.zsh-run +++ b/machine-based/thinkpad/homes-and-paths.zsh-run @@ -1,17 +0,0 @@ -## PATH -# export PATH="$PATH:/opt/scala-2.11.5/bin" -# export PATH="$PATH:/opt/idea-IU-143.1184.17/bin" -# export PATH="$PATH:/home/knub/.cargo/bin" -#export PATH="/opt/anaconda3/bin:$PATH" - -## JAVA HOME -#export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64 -#export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_31 -export JAVA_HOME=/etc/alternatives/java_sdk - -## HADOOP_HOME -export HADOOP_HOME="/home/knub/Programme/hadoop-2.5.1" -export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native - -## ANDROID -export ANDROID_HOME="/opt/android-sdk" diff --git a/machine-based/thinkpad/navigation.zsh-run b/machine-based/thinkpad/navigation.zsh-run index 6643a87..e69de29 100644 --- a/machine-based/thinkpad/navigation.zsh-run +++ b/machine-based/thinkpad/navigation.zsh-run @@ -1,14 +0,0 @@ -alias cdonehundredandeighty="cd ~/Repositories/onehundredandeighty" -alias cdthesis='cd ~/Repositories/master-thesis/thesis' -alias cddata='cd ~/Repositories/master-thesis/data' -alias cdmodels='cd ~/Repositories/master-thesis/models' -alias cdresults='cd ~/Repositories/master-thesis/results' -alias cdmaster='cd ~/Repositories/master-thesis' -alias cdscala='cd ~/Repositories/master-thesis/code/scala' -alias cdpython='cd ~/Repositories/master-thesis/code/python/knub/thesis' -alias cdword2vec='cd ~/Repositories/word2vec/trunk' -alias cdlftm='cd ~/Repositories/LFTM' -alias cdgaussian='cd ~/Repositories/Gaussian_LDA' -alias cdtopicvec='cd ~/Repositories/topicvec' -alias cdshdp='cd ~/Repositories/sHDP' -alias vimthesis='vim /home/knub/Repositories/master-thesis/thesis/thesis.tex' diff --git a/machine-based/thinkpad/project/coheel.zsh-run b/machine-based/thinkpad/project/coheel.zsh-run deleted file mode 100644 index eadca53..0000000 --- a/machine-based/thinkpad/project/coheel.zsh-run +++ /dev/null @@ -1,12 +0,0 @@ -function tenem-cluster() { - cssh hadoop10@tenem11 \ - hadoop10@tenem12 \ - hadoop10@tenem13 \ - hadoop10@tenem14 \ - hadoop10@tenem15 \ - hadoop10@tenem16 \ - hadoop10@tenem17 \ - hadoop10@tenem18 \ - hadoop10@tenem19 \ - hadoop10@tenem20 -} diff --git a/setup_machine.sh b/setup_machine.sh index 5c166e7..1ed6519 100755 --- a/setup_machine.sh +++ b/setup_machine.sh @@ -1,6 +1,6 @@ #!/bin/bash -PACKAGE_MANAGER=dnf +PACKAGE_MANAGER=apt set -o xtrace @@ -9,38 +9,33 @@ if ! test -f zsh/antigen/Makefile ; then git submodule update fi -if ! grep -q "defaultyes" /etc/dnf/dnf.conf ; then - echo "defaultyes=True" | sudo tee -a /etc/dnf/dnf.conf -fi - sudo $PACKAGE_MANAGER upgrade sudo $PACKAGE_MANAGER install \ - alacarte \ - autokey-gtk \ curl \ dconf-editor \ htop \ powertop \ - gimp \ gitg \ - gnome-tweak-tool \ + gnome-tweaks \ gparted \ - gvim \ + vim-gtk3 \ iotop \ - ImageMagick \ + imagemagick \ inkscape \ meld \ + ncdu \ nethogs \ - rubygem-rake \ - sl \ - the_silver_searcher \ + rake \ + silversearcher-ag \ tree \ - texlive \ tilda \ tlp \ tlp-rdw \ - unison \ + ubuntu-restricted-extras \ + ubuntu-restricted-addons \ + unison-gtk \ vim \ + xclip \ zsh @@ -48,10 +43,6 @@ if ! grep -q "knub:/bin/zsh" /etc/passwd ; then chsh -s /bin/zsh fi -if ! dnf repolist | grep -q "home_snwh_paper" ; then - sudo dnf config-manager --add-repo http://download.opensuse.org/repositories/home:snwh:paper/Fedora_25/home:snwh:paper.repo - sudo dnf install paper-gtk-theme paper-icon-theme -fi if ! test -L ~/.zshrc ; then rake install diff --git a/system/kitty.zsh-run b/system/kitty.zsh-run new file mode 100644 index 0000000..76e62d4 --- /dev/null +++ b/system/kitty.zsh-run @@ -0,0 +1,14 @@ +alias icat="kitty +kitten icat --align left" + +function show_rocs() { + for d in $(gsutil ls "gs://mx-healthcare-derived/experiments/smart_elimination/image/$1/**/roc_curve_screen_detected_cancers.png"); do + dataset=${d/*$1\//}; + dataset=${dataset/\/cancer_detection_task*/}; + dataset=${dataset:19} + echo $dataset | tr a-z A-Z; + gsutil cp $d . 2> /dev/null + icat roc_curve_screen_detected_cancers.png + rm roc_curve_screen_detected_cancers.png + done; +} + diff --git a/system/util.zsh-run b/system/util.zsh-run index f5dab06..040f6fc 100644 --- a/system/util.zsh-run +++ b/system/util.zsh-run @@ -6,7 +6,7 @@ function watchdir() { # find file, ignore gitignored files function ff() { - ag -l --nocolor --hidden -g "$1" + ag --skip-vcs-ignores -l --nocolor --hidden -g "$1" } # find file, do not ignore gitignored files function ffa() { @@ -46,3 +46,10 @@ function byobustart() { } alias sum='awk "{ sum += \$1 } END { print sum }"' + +function lsdownloads() { + ls ~/Downloads +} +function rmdownloads() { + rm ~/Downloads/* +} diff --git a/tilda/tilda.symlink/config_0 b/tilda/tilda.symlink/config_0 deleted file mode 100644 index defa1df..0000000 --- a/tilda/tilda.symlink/config_0 +++ /dev/null @@ -1,101 +0,0 @@ -tilda_config_version="0.9.6" -# command="" -font="Hack 12" -key="F1" -addtab_key="t" -fullscreen_key="F11" -toggle_transparency_key="F12" -toggle_searchbar_key="f" -closetab_key="w" -nexttab_key="Page_Down" -prevtab_key="Page_Up" -movetableft_key="Page_Up" -movetabright_key="Page_Down" -gototab_1_key="1" -gototab_2_key="2" -gototab_3_key="3" -gototab_4_key="4" -gototab_5_key="5" -gototab_6_key="6" -gototab_7_key="7" -gototab_8_key="8" -gototab_9_key="9" -gototab_10_key="0" -copy_key="c" -paste_key="v" -quit_key="q" -title="Tilda" -background_color="white" -# working_dir="" -web_browser="google-chrome" -increase_font_size_key="equal" -decrease_font_size_key="minus" -normalize_font_size_key="0" -show_on_monitor="eDP1" -word_chars="-A-Za-z0-9,./?%&#:_" -lines=1000000 -max_width=1920 -max_height=421 -min_width=1 -min_height=1 -x_pos=0 -y_pos=659 -tab_pos=0 -backspace_key=0 -delete_key=1 -d_set_title=3 -command_exit=2 -scheme=0 -slide_sleep_usec=500 -animation_orientation=1 -timer_resolution=200 -auto_hide_time=2000 -on_last_terminal_exit=0 -palette_scheme=0 -non_focus_pull_up_behaviour=0 -cursor_shape=0 -# show_on_monitor_number=0 -title_max_length=25 -palette = {11822, 13364, 13878, 52428, 0, 0, 20046, 39578, 1542, 50372, 41120, 0, 13364, 25957, 42148, 30069, 20560, 31611, 1542, 38944, 39578, 54227, 55255, 53199, 21845, 22359, 21331, 61423, 10537, 10537, 35466, 58082, 13364, 64764, 59881, 20303, 29298, 40863, 53199, 44461, 32639, 43176, 13364, 58082, 58082, 61166, 61166, 60652} -scrollbar_pos=1 -back_red=65535 -back_green=65535 -back_blue=65535 -text_red=0 -text_green=0 -text_blue=0 -cursor_red=0 -cursor_green=0 -cursor_blue=0 -scroll_history_infinite=true -scroll_on_output=false -notebook_border=true -antialias=true -scrollbar=false -grab_focus=true -above=false -notaskbar=true -bold=true -blinks=true -scroll_on_key=true -bell=false -run_command=false -pinned=false -animation=false -hidden=true -set_as_desktop=false -centered_horizontally=false -centered_vertically=false -enable_transparency=true -double_buffer=true -auto_hide_on_focus_lost=false -auto_hide_on_mouse_leave=false -title_max_length_flag=true -inherit_working_dir=true -command_login_shell=false -start_fullscreen=false -# image="" -# scroll_background=false -# use_image=false -transparency=0 -back_alpha=65535 diff --git a/vim/aliases.zsh-run b/vim/aliases.zsh-run index 984ff78..28dd137 100644 --- a/vim/aliases.zsh-run +++ b/vim/aliases.zsh-run @@ -1 +1,5 @@ alias vim='gvim -p -v' + +function vimpy() { + gvim -p -v "$1" && python "$1" +} diff --git a/vim/vimrc.symlink b/vim/vimrc.symlink index 7149dab..7eff30a 100644 --- a/vim/vimrc.symlink +++ b/vim/vimrc.symlink @@ -64,7 +64,7 @@ let g:hugefile_trigger_size = '10000' " files over x MB are considered as large, " Visible git undo tree Plugin 'sjl/gundo.vim' " Python -Plugin 'klen/python-mode' +" Plugin 'klen/python-mode' " Gitignore Plugin 'rdolgushin/gitignore.vim' " Time tracking @@ -114,6 +114,12 @@ nmap . .`[ " Set terminal title set title +" ================================================== +" Git +" ================================================== +" Always start on first line of git commit message, from http://vim.wikia.com/wiki/Always_start_on_first_line_of_git_commit_message +autocmd FileType gitcommit call setpos('.', [0, 1, 1, 0]) + " ================================================== " Editing @@ -167,6 +173,11 @@ set splitbelow set wildmenu +autocmd BufRead,BufNewFile *.tsv set filetype=tsv +autocmd FileType tsv setlocal tabstop=32 noexpandtab +au FileType tsv let Comment="#" | let EndComment="" + + " ================================================== " Search " ================================================== diff --git a/zsh/antigen b/zsh/antigen index 1359b99..74aa897 160000 --- a/zsh/antigen +++ b/zsh/antigen @@ -1 +1 @@ -Subproject commit 1359b9966689e5afb666c2c31f5ca177006ce710 +Subproject commit 74aa89757038e42d472db22cb5b5bc6cbd4edb93 diff --git a/zsh/zshrc.symlink b/zsh/zshrc.symlink index cc2d5dd..ada0de1 100644 --- a/zsh/zshrc.symlink +++ b/zsh/zshrc.symlink @@ -1,17 +1,14 @@ export DOTFILES=$HOME/dotfiles ### Antigen +setopt INTERACTIVE_COMMENTS source $DOTFILES/zsh/antigen/antigen.zsh antigen use oh-my-zsh antigen bundle arzzen/calc.plugin.zsh antigen bundle dirhistory -#antigen bundle djui/alias-tips antigen bundle extract antigen bundle mvn antigen bundle vagrant antigen bundle web-search -#antigen theme kafeitu -#antigen-bundle arialdomartini/oh-my-git -#antigen theme arialdomartini/oh-my-git-themes oppa-lana-style antigen apply # Replace known paths with their variable short form @@ -28,6 +25,16 @@ for config_file ($DOTFILES/**/*.zsh-run) source $config_file export HISTSIZE=100000 export SAVEHIST=100000 -# source "$HOME/.qfc/bin/qfc.sh" -# qfc_quick_command 'cd' '\C-b' 'cd $0' -# qfc_quick_command 'vim' '\C-p' 'vim $0' +# The next line updates PATH for the Google Cloud SDK. +if [ -f /opt/google-cloud-sdk/path.zsh.inc ]; then + source '/opt/google-cloud-sdk/path.zsh.inc' +fi + +# The next line enables shell command completion for gcloud. +if [ -f /opt/google-cloud-sdk/completion.zsh.inc ]; then + source '/opt/google-cloud-sdk/completion.zsh.inc' +fi + +source $HOME/merantix/core/developer_env/setup.sh EDISON +unset DIR +