diff options
author | Urbain Vaes <urbain@vaes.uk> | 2015-08-11 15:58:37 +0200 |
---|---|---|
committer | Urbain Vaes <urbain@vaes.uk> | 2015-08-11 15:58:37 +0200 |
commit | 5e17418f1eef06e97bb621edf53530437df8b14f (patch) | |
tree | f87466982929a0d0fead9ec97a5e9b017c76bf9e | |
parent | 8df9472e0cdbab0d12211c2bc77918e8f515c409 (diff) |
Back up several files
-rw-r--r-- | .grmrc | 3 | ||||
-rw-r--r-- | .i3/config | 4 | ||||
-rw-r--r-- | .mutt/aliase | 1 | ||||
-rw-r--r-- | .notes/Notes | 4 | ||||
-rw-r--r-- | .uzbl/config | 23 | ||||
-rwxr-xr-x | .uzbl/scripts/adblock.py | 86 | ||||
-rwxr-xr-x | .uzbl/scripts/downloadviewer.sh | 7 | ||||
-rwxr-xr-x | .uzbl/scripts/goup.pl | 24 | ||||
-rwxr-xr-x | .uzbl/scripts/mytest.sh | 14 | ||||
-rwxr-xr-x | .uzbl/scripts/ytdl.sh | 8 | ||||
-rwxr-xr-x | .xinitrc | 3 | ||||
-rw-r--r-- | .zsh/aliases (renamed from .zsh/zsh-aliases) | 11 | ||||
-rw-r--r-- | .zsh/functions (renamed from .zsh/zsh-functions) | 16 | ||||
-rw-r--r-- | .zsh/plugins (renamed from .zsh/zsh-plugins) | 4 | ||||
-rw-r--r-- | .zsh/tmp (renamed from .zsh/zsh-tmp) | 2 | ||||
-rw-r--r-- | .zsh/zshrc | 36 | ||||
-rwxr-xr-x | bin/keyboard.sh | 3 |
17 files changed, 154 insertions, 95 deletions
@@ -26,6 +26,9 @@ repodirs[adbrebs/taxi]=/home/urbain/github/adbrebs/taxi repodirs[adbrebs/meg]=/home/urbain/github/adbrebs/meg repodirs[adbrebs/brain_segmentation]=/home/urbain/github/adbrebs/brain_segmentation +# Uzbl +repodirs[zimon/uzbl-config-and-scripts]=/home/urbain/github/uzbl + # Installation function after_vimplug { cd .. @@ -44,11 +44,11 @@ bindsym $mod+Return exec i3-sensible-terminal bindsym $mod+d kill # start dmenu (a program launcher) -bindsym $mod+p exec dmenu_run +# bindsym $mod+p exec dmenu_run # There also is the (new) i3-dmenu-desktop which only displays applications # shipping a .desktop file. It is a wrapper around dmenu, so you need that # installed. -# bindsym $mod+p exec --no-startup-id i3-dmenu-desktop +bindsym $mod+p exec --no-startup-id i3-dmenu-desktop # change focus bindsym $mod+h focus left diff --git a/.mutt/aliase b/.mutt/aliase new file mode 100644 index 0000000..dbc8113 --- /dev/null +++ b/.mutt/aliase @@ -0,0 +1 @@ +alias clement.vaes Clement Vaes <clement.vaes@student.uclouvain.be> diff --git a/.notes/Notes b/.notes/Notes index 6976cf5..20af389 100644 --- a/.notes/Notes +++ b/.notes/Notes @@ -21,3 +21,7 @@ Notes # Useful info • Bank number: 930630876 + +# Ideas + • Libgen CLI + • Plugin manager uzbl diff --git a/.uzbl/config b/.uzbl/config index 5539181..bb71fec 100644 --- a/.uzbl/config +++ b/.uzbl/config @@ -39,7 +39,7 @@ set set_mode = set mode = set set_status = set status_message = # Spawn path shortcuts. In spawn the first dir+path match is used in "dir1:dir2:dir3:executable" -set scripts_dir = /home/urbain/dotfiles/config/uzbl/scripts:@data_home/uzbl:@prefix/share/uzbl/examples/data:scripts +set scripts_dir = /home/urbain/dotfiles/.uzbl:@data_home/uzbl:@prefix/share/uzbl/examples/data:scripts ## Hardcoded handlers @@ -359,17 +359,6 @@ set follow_hint_keys = uhetonasidpgcr @cbind F* = spawn @scripts_dir/follow.sh \@< uzbl.follow("\@follow_hint_keys", "%s", 'newwindow') >\@ @cbind fL* = spawn @scripts_dir/follow.sh \@< uzbl.follow("\@follow_hint_keys", "%s", 'returnuri') >\@ set @cbind FL* = spawn @scripts_dir/follow.sh \@< uzbl.follow("\@follow_hint_keys", "%s", 'returnuri') >\@ clipboard -@cbind fi = spawn @scripts_dir/go_input.sh - -@cbind fs = spawn @scripts_dir/follow.sh \@< uzbl.follow.followSelection('returnuri') >\@ set -@cbind fS = spawn @scripts_dir/follow.sh \@< uzbl.follow.followSelection('click') >\@ -@cbind Fs = spawn @scripts_dir/follow.sh \@< uzbl.follow.followSelection('newwindow') >\@ -@cbind FS = spawn @scripts_dir/follow.sh \@< uzbl.follow.followSelection('returnuri') >\@ clipboard - -@cbind ft* = spawn @scripts_dir/follow.sh \@< uzbl.follow.followTextContent("%s", 'returnuri') >\@ set -@cbind fT* = spawn @scripts_dir/follow.sh \@< uzbl.follow.followTextContent("%s", 'click') >\@ -@cbind Ft* = spawn @scripts_dir/follow.sh \@< uzbl.follow.followTextContent("%s", 'newwindow') >\@ -@cbind FT* = spawn @scripts_dir/follow.sh \@< uzbl.follow.followTextContent("%s", 'returnuri') >\@ clipboard @cbind '* = spawn @scripts_dir/follow.sh \@< uzbl.follow.followTextContent("%s", 'click') >\@ @@ -422,9 +411,6 @@ menu_add Quit uzbl = exit # Link context menu menu_link_add Print Link = print \@SELECTED_URI -# Go up one dir -@cbind gu = spawn @scripts_dir/goup.pl - # Mode configuration # Define some mode specific uzbl configurations. @@ -496,4 +482,11 @@ bind 'aur _ = sh 'surfraw -g $8 %s' aur bind 'freshmeat _ = sh 'surfraw -g $8 %s' freshmeat bind 'weather _ = sh 'surfraw -g $8 %s' weather +# Custom binds +@cbind gu = spawn @scripts_dir/test.sh +@cbind gU = spawn @scripts_dir/mytest.sh +@cbind ytdl = sh '$HOME/dotfiles/.uzbl/scripts/ytdl.sh "$UZBL_URI"' + +@on_event DOWNLOAD_COMPLETE spawn @scripts_dir/downloadviewer.sh %s +@on_event LOAD_COMMIT spawn @scripts_dir/adblock.py # vim: set fdm=syntax: diff --git a/.uzbl/scripts/adblock.py b/.uzbl/scripts/adblock.py new file mode 100755 index 0000000..aae39f4 --- /dev/null +++ b/.uzbl/scripts/adblock.py @@ -0,0 +1,86 @@ +#!/usr/bin/python +import os +from sys import argv +from urlparse import urlparse + +# This is the original adblock.py script from http://www.uzbl.org/wiki/adblock +# Nothing was modified. This script is here just to have everything at one place. + +def xdghome(key, default): + '''Attempts to use the environ XDG_*_HOME paths if they exist otherwise + use $HOME and the default path.''' + + xdgkey = "XDG_%s_HOME" % key + if xdgkey in os.environ.keys() and os.environ[xdgkey]: + return os.environ[xdgkey] + + return os.path.join(os.environ['HOME'], default) + +# Setup xdg paths. +DATA_DIR = os.path.join(xdghome('DATA', '.local/share/'), 'uzbl/') + +# Blockfile location. +BLOCKFILE = os.path.join(DATA_DIR, 'adblock') + +JAVASCRIPT = ' '.join(filter(None, map(str.strip, ''' +var uzblAdBlock = function() { + var toblock = %s; + for(var n = 0; n < toblock.length; n++) { + var items; + while (1) { + try { + items = document.evaluate(toblock[n], document, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null); + if (items == null) { break; } + var i = items.iterateNext(); + if (i == null) { break; } + i.parentNode.removeChild(i); + } catch (e) { + break; + } + } + } +}; +'''.split('\n')))) + + +def get_domain(url): + '''Return domain segment of url.''' + + if not url.startswith('http'): + url = "http://%s" % url + + loc = urlparse(url).netloc + if loc.startswith('www.'): + loc = loc[4:] + + return loc + + +def adblock(url, fifo): + fh = open(BLOCKFILE, 'r') + lines = [line.strip() for line in fh.readlines()] + fh.close() + + rules, capture = [], False + for l in lines: + if not l: # newline splits section + capture = False + + elif l[0] == '#': + continue + + elif capture: + rules.append(l) + + elif l[-1] == ':': + if get_domain(l[:-1]) == url or l[:-1] == "global": + capture = True + + rulestr = repr(rules).replace("@", "\@") + js = "js %s\n" % (JAVASCRIPT % rulestr) + fh = open(fifo, "w") + fh.write(js) + fh.close() + +if __name__ == '__main__': + adblock(get_domain(argv[6]), argv[4]) diff --git a/.uzbl/scripts/downloadviewer.sh b/.uzbl/scripts/downloadviewer.sh new file mode 100755 index 0000000..306460d --- /dev/null +++ b/.uzbl/scripts/downloadviewer.sh @@ -0,0 +1,7 @@ +#!/bin/sh +case "$1" in +*.pdf*) zathura "$1" & ;; +*.jpg*|*.png*|*.jpeg*) feh "$1" & ;; +*.txt*|*README*|*.pl*|*.sh*|*.py*|*.hs*|*.hl*) urxvt -e vim "$1" & ;; +*.mov*|*.avi*|*.mpeg*|*.mpg*|*.flv*|*.wmv*|*.mp4*) mplayer "$1" & ;; +esac diff --git a/.uzbl/scripts/goup.pl b/.uzbl/scripts/goup.pl deleted file mode 100755 index f7ae275..0000000 --- a/.uzbl/scripts/goup.pl +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/perl - -my ($config,$pid,$xid,$fifo,$socket,$url,$title,$cmd) = @ARGV; -if($fifo eq "") { die "No fifo"; }; - -# Delete last slash -chop($url); - -my $index = index(reverse($url), '/'); - -# if youre already on top of the directory structure -if ($index == -1) -{ - print $url; - exit; -} - -# Workaround for missing reverse index -$url = (substr(reverse($url), $index, length($url) )); -$url = reverse($url); -print $url."\n"; - -# This could look prettier with native fifo access -qx(echo "act uri $url" >> $fifo); diff --git a/.uzbl/scripts/mytest.sh b/.uzbl/scripts/mytest.sh new file mode 100755 index 0000000..f310e49 --- /dev/null +++ b/.uzbl/scripts/mytest.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +. "$UZBL_UTIL_DIR/uzbl-dir.sh" + +>> "$UZBL_BOOKMARKS_FILE" || exit 1 + +which zenity >/dev/null 2>&1 || exit 2 + +tags="$( zenity --entry --text="Enter space-separated tags for bookmark $UZBL_URI:" )" +exitstatus="$?" +[ "$exitstatus" -eq 0 ] || exit "$exitstatus" + +# TODO: check if already exists, if so, and tags are different: ask if you want to replace tags +echo "$UZBL_URI $tags" >> "$UZBL_BOOKMARKS_FILE" diff --git a/.uzbl/scripts/ytdl.sh b/.uzbl/scripts/ytdl.sh new file mode 100755 index 0000000..acf327a --- /dev/null +++ b/.uzbl/scripts/ytdl.sh @@ -0,0 +1,8 @@ +#!/bin/bash +cd ~/Downloads # change this line to determine where the file is saved +python2 youtube-dl -o %\(title\)s.%\(ext\)s "$1" # -o output template is optional +# play with mplayer after download +savename=`python2 youtube-dl -o %\(title\)s.%\(ext\)s --get-filename "$1"` +mplayer -really-quiet "$savename" +ratpoison -c "echo [ytdl-uzbl] $1 done." # change this line to change how you are notified of a + # completed download @@ -7,11 +7,10 @@ xset r rate 400 50 $HOME/bin/keyboard.sh # Load Xresources to light colorscheme -xrdb $HOME/.Xresources/Xresources.dark +xrdb $HOME/.Xresources/dark # Start gpg-agent killall -9 gpg-agent gpg-agent --daemon --enable-ssh-support \ --write-env-file "${HOME}/.gpg-agent-info" - diff --git a/.zsh/zsh-aliases b/.zsh/aliases index 9d2dbe6..28cd4dd 100644 --- a/.zsh/zsh-aliases +++ b/.zsh/aliases @@ -1,3 +1,5 @@ +#!/bin/zsh + # Apps for filetypes alias -s vim=$EDITOR alias -s cpp=$EDITOR @@ -20,23 +22,18 @@ alias ur='cd ~/Dropbox/phd/reports' alias a='vifm' alias c='clear' alias ca='printf "\ec"' -alias commit='git commit -a -m' alias g='git' -alias install='sudo apt-get install' alias m='mutt' alias mail='offlineimap -u quiet &' alias mc='make clean' alias mca='make clean-all' alias n='nvim' alias ns="$EDITOR -S Session.vim" -alias pull='git pull origin master' -alias push='git push origin master' alias pushs='git push --recurse-submodules=check' -alias update='sudo apt-get update' -alias upgrade='sudo apt-get upgrade' alias v='vim' alias x='sh ~/.xmodmap' -alias youtube=mpsyt +alias youtube='mpsyt' +alias notes='vim ~/dotfiles/.notes/Notes' # Configuration alias em="$EDITOR ~/.mutt/muttrc" diff --git a/.zsh/zsh-functions b/.zsh/functions index f9f387d..557d1af 100644 --- a/.zsh/zsh-functions +++ b/.zsh/functions @@ -1,24 +1,18 @@ +#!/bin/zsh + function colo { # Change colors for current session - $HOME/.bin/recolor.sh < ~/.Xresources/Xresources.$1 + $HOME/.bin/recolor.sh < ~/.Xresources/$1 # Load Xresources file for future sessions - xrdb ~/.Xresources/Xresources.$1 + xrdb ~/.Xresources/$1 # Change environment variable export COLORSCHEME=$1 # Change default environment variable for future sessions - sed -i --follow-symlinks "s/^export COLORSCHEME=.*$/export COLORSCHEME=$1/g" ~/dotfiles/zshrc -} - -z() { - if [[ -z "$*" ]]; then - cd "$(_z -l 2>&1 | fzf-tmux +s --tac | sed 's/^[0-9,.]* *//')" - else - _z "$@" - fi + sed -i --follow-symlinks "s/^export COLORSCHEME=.*$/export COLORSCHEME=$1/g" ~/.zsh/tmp } fshow() { diff --git a/.zsh/zsh-plugins b/.zsh/plugins index 26b5726..b519e4b 100644 --- a/.zsh/zsh-plugins +++ b/.zsh/plugins @@ -1,3 +1,5 @@ +#! /bin/zsh + # Load zgen source "/home/urbain/.zgen/zgen.zsh" @@ -38,7 +40,7 @@ if ! zgen saved; then zgen save fi -# Plugin configuration +# Plugins configuration # Autosuggestion { @@ -1 +1,3 @@ +#!/bin/zsh + export COLORSCHEME=light @@ -1,11 +1,7 @@ -ZSH_PLUGINS="$HOME/.zsh/zsh-plugins" -ZSH_ALIASES="$HOME/.zsh/zsh-aliases" -ZSH_TMP="$HOME/.zsh/zsh-tmp" - -# Source configurations -source $ZSH_PLUGINS -source $ZSH_ALIASES -source $ZSH_TMP +source "$HOME/.zsh/plugins" +source "$HOME/.zsh/functions" +source "$HOME/.zsh/aliases" +source "$HOME/.zsh/tmp" # Custom key bindings for built-in widgets bindkey -a 'k' history-beginning-search-backward @@ -20,30 +16,6 @@ export PATH="$PATH:/home/urbain/.local/bin" # Editor export EDITOR=/usr/bin/nvim -fshow() { - git log --graph --color=always \ - --format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" | - fzf --ansi --no-sort --reverse --tiebreak=index --toggle-sort=\` \ - --bind 'ctrl-m:execute: - echo {} | grep -o "[a-f0-9]\{7\}" | - xargs -I % sh -c "git show --color=always % | less -R"' -} - -function colo { - -# Change colors for current session -$HOME/.bin/recolor.sh < ~/.Xresources/Xresources.$1 - -# Load Xresources file for future sessions -xrdb ~/.Xresources/Xresources.$1 - -# Change environment variable -export COLORSCHEME=light - -# Change default environment variable for future sessions -sed -i --follow-symlinks "s/^export COLORSCHEME=.*$/export COLORSCHEME=$1/g" ~/dotfiles/zshrc -} - # Fix tmux colors if [[ -n ${TMUX} && -n ${commands[tmux]} ]];then case $(tmux showenv TERM 2>/dev/null) in diff --git a/bin/keyboard.sh b/bin/keyboard.sh index e0759ab..13a599f 100755 --- a/bin/keyboard.sh +++ b/bin/keyboard.sh @@ -1,4 +1,5 @@ -# Dvorak programer setxkbmap us -variant dvp +# Dvorak programer +setxkbmap us -variant dvp # Make caps lock a Control xmodmap -e "clear Lock" |