diff --git a/.agignore b/.agignore new file mode 100644 index 0000000..0d20b64 --- /dev/null +++ b/.agignore @@ -0,0 +1 @@ +*.pyc diff --git a/.bashrc b/.bashrc index 7657dba..be35479 100644 --- a/.bashrc +++ b/.bashrc @@ -171,7 +171,7 @@ if [ -e ~/.ssh/config.d ]; then #if find ~/.ssh/config.d -mindepth 1 -print -quit | grep -q .; then # Do we have config files in that directory? if find ~/.ssh/config.d -print -quit | grep -q .; then - newestconfig=$(find ~/.ssh/config.d/* -printf '@T+ %p\n' | sort -r | head -n1 | awk '{print $2}') + newestconfig=$(find ~/.ssh/config.d/* -printf '%Tc %p\n' | sort -r | head -n1 | awk '{print $3}') if [ "$newestconfig" -nt ~/.ssh/config ]; then # We found a config that's newer than the generated config file, re-generate [ -e ~/.ssh/config ] && mv ~/.ssh/config ~/.ssh/config.bak.$(date -Ins) @@ -214,3 +214,5 @@ export NVM_DIR="${HOME}/.nvm" # QT autoscaling, helpful for hidpi systems export QT_AUTO_SCREEN_SCALE_FACTOR=1 + +[ -f ~/.fzf.bash ] && source ~/.fzf.bash diff --git a/.config/fish/config.fish b/.config/fish/config.fish index 7d4f4fd..7f7db56 100644 --- a/.config/fish/config.fish +++ b/.config/fish/config.fish @@ -5,8 +5,14 @@ set EDITOR vim eval (python -m virtualfish compat_aliases) # Theme options for bobthefish +set -g theme_nerd_fonts yes set -g theme_show_exit_status yes set -g theme_date_format "+%a %Y-%m-%d %H:%M:%S" +set -g theme_avoid_ambiguous_glyphs yes +#set -g theme_color_scheme "zenburn" + +# If you use virtualenv, you will probably need to disable the default virtualenv prompt, since it doesn't play nice with fish +set -x VIRTUAL_ENV_DISABLE_PROMPT 1 # grc colouriser set -U grcplugin_ls --color @@ -33,6 +39,12 @@ end # QT autoscaling, helpful for hidpi systems set -x QT_AUTO_SCREEN_SCALE_FACTOR 1 +# SilverSearcher 'ag' ('ack' and 'grep' replacement) +#set -gx FZF_DEFAULT_COMMAND 'ag -g ""' +set -gx FZF_DEFAULT_COMMAND 'rg --files --no-ignore --hidden --follow --glob "!.git/*" --glob "!*.pyc"' +set -gx FZF_CTRL_T_COMMAND "$FZF_DEFAULT_COMMAND" +set -gx FZF_ALT_C_COMMAND "$FZF_DEFAULT_COMMAND" + # Aliases ## Listing alias ll 'ls -alF' @@ -53,6 +65,11 @@ alias gl "git log" alias gt 'git tag|less' #alias gad 'git log --pretty='"'"'%at'"'"' | while read d; do date -d "@$d"; done | awk '"'"'{print $1}'"'"' | sort | uniq -c' +alias ffnightly 'env MOZ_USE_XINPUT2=1 /usr/local/bin/firefoxnightly/firefox' + +## SSH, for compatibility, as our terminfo now is non-standard 'tmux-256color-italic' in tmux +alias ssh 'env TERM=xterm-256color ssh' + ## Grepping alias findfile 'find . | grep -v .svn | grep -v .hg | grep -v .git | grep' alias findphp 'find . -name "*.php" | xargs grep --color=auto' diff --git a/.config/fish/fishfile b/.config/fish/fishfile index 13c6386..9215e1b 100644 --- a/.config/fish/fishfile +++ b/.config/fish/fishfile @@ -1,7 +1,11 @@ +fisherman/await edc/bass oh-my-fish/theme-bobthefish +fisherman/fzf +fisherman/get fisherman/getopts oh-my-fish/plugin-grc +fisherman/last_job_id fisherman/nvm fisherman/shark fisherman/z diff --git a/.terminfo/t/tmux-256color-italic b/.terminfo/t/tmux-256color-italic new file mode 100644 index 0000000..fab849a Binary files /dev/null and b/.terminfo/t/tmux-256color-italic differ diff --git a/.terminfo/tmux-256color-italic.terminfo b/.terminfo/tmux-256color-italic.terminfo new file mode 100644 index 0000000..576c03b --- /dev/null +++ b/.terminfo/tmux-256color-italic.terminfo @@ -0,0 +1,13 @@ +# A xterm-256color based TERMINFO that adds the escape sequences for italic. +# +# Install: +# +# tic xterm-256color-italic.terminfo +# +# Usage: +# +# export TERM=xterm-256color-italic +# +tmux-256color-italic|tmux with 256 colors and italic, + sitm=\ePtmux;\e\E[3m\e\\, ritm=\ePtmux;\e\E[23m\e\\, + use=screen-256color, diff --git a/.tmux.conf b/.tmux.conf index ea562b9..b1b9d50 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -2,7 +2,7 @@ set -g bell-action any # Default termtype. If the rcfile sets $TERM, that overrides this value. -set -g default-terminal screen-256color +set -g default-terminal tmux-256color-italic # Keep your finger on ctrl, or don't bind-key ^D detach-client diff --git a/.vim/spell/nl.utf-8.add b/.vim/spell/nl.utf-8.add index 8fee085..d0349f9 100644 --- a/.vim/spell/nl.utf-8.add +++ b/.vim/spell/nl.utf-8.add @@ -32,3 +32,33 @@ Xylometazoline gedehydrateerd ofzo dubbelaflevering +bolognese +penne +draagconsulente +verstikkingsgevaar +warmteregulerend +draagpop +chocoladehagel +standup +crappy +cogitorama +weekplanning +Trello +footer +slavink +meh +review +kudos +zevenen +planningsessie +aangeprutst +bapao +bapao's +thuiskantoor +grilham +paasontbijt +paaseitjes +schuifje +magneetjes +Vomar +weekplanner diff --git a/.vim/spell/nl.utf-8.add.spl b/.vim/spell/nl.utf-8.add.spl index 25d25bf..a9d890f 100644 Binary files a/.vim/spell/nl.utf-8.add.spl and b/.vim/spell/nl.utf-8.add.spl differ diff --git a/.vim/syntax/todo.vim b/.vim/syntax/todo.vim index 379d42d..d911365 100644 --- a/.vim/syntax/todo.vim +++ b/.vim/syntax/todo.vim @@ -32,9 +32,15 @@ highlight link todoComment Comment " Heading (day) delimiters -syn region todoDay matchgroup=todoHeadingDelimiter start="==\@!" end="==*\s*$" keepend oneline +syntax region todoDay start=/\v\=\=\ / skip=/\v\\./ end=/\v\ \=\=\=\=\=\=/ -hi def link todoHeadingDelimiter Delimiter +hi link todoDay Delimiter + + +" Show -scratched out- parts of a line as darker text (Delimiter colour) +syntax region scratchThis start=/\v -/ skip=/\v\\./ end=/\v-\ / oneline + +hi link scratchThis Delimiter " Generic operators @@ -52,22 +58,24 @@ syntax match note "\v n .*$" syntax match note "\v .*$" highlight note ctermfg=Grey guifg=#eeeeee -syntax match todoStatusDone "\v^v " -syntax match todoStatusDone "\v v " -syntax match todoStatusDone "\v^x " -syntax match todoStatusDone "\v x " +syntax match todoStatusDone "\v^v " nextgroup=todoItem skipwhite +syntax match todoStatusDone "\v v " nextgroup=todoItem skipwhite highlight todoStatusDone ctermfg=green guifg=#00ff00 -syntax match todoStatusDoing "\v^d .*$" -syntax match todoStatusDoing "\v d .*$" +syntax match todoStatusCancelled "\v^x " nextgroup=todoItem skipwhite +syntax match todoStatusCancelled "\v x " nextgroup=todoItem skipwhite +highlight todoStatusCancelled ctermfg=DarkGreen + +syntax match todoStatusDoing "\v^d .*$" nextgroup=todoItem skipwhite +syntax match todoStatusDoing "\v d .*$" nextgroup=todoItem skipwhite highlight todoStatusDoing ctermfg=223 guifg=#f0dfaf -syntax match todoStatusTest "\v^t " -syntax match todoStatusTest "\v t " +syntax match todoStatusTest "\v^t " nextgroup=todoItem skipwhite +syntax match todoStatusTest "\v t " nextgroup=todoItem skipwhite highlight todoStatusTest ctermfg=darkcyan guifg=#6666ff -syntax match todoStatusTodo "\v^- " -syntax match todoStatusTodo "\v - " +syntax match todoStatusTodo "\v^- " nextgroup=todoItem skipwhite +syntax match todoStatusTodo "\v - " nextgroup=todoItem skipwhite highlight todoStatusTodo ctermfg=red guifg=#ff0000 syntax match todoStatusImportant "\v^\> .*$" @@ -77,10 +85,20 @@ syntax match todoStatusImportant "\v ! .*$" "highlight todoStatusImportant ctermfg=131 guifg=#af5f5f highlight todoStatusImportant ctermfg=167 guifg=#d75f5f -syntax match todoStatusQuestion "\v^\? " -syntax match todoStatusQuestion "\v \? " +syntax match todoStatusQuestion "\v^\? " nextgroup=todoItem skipwhite +syntax match todoStatusQuestion "\v \? " nextgroup=todoItem skipwhite highlight todoStatusQuestion ctermfg=darkcyan guifg=#6666ff +" Highlight matching brackets (for example a timeslot) +"syntax match brack /[\[\]]/ | hi brack ctermfg=DarkMagenta + +syntax match timeslot "\v\[.*-.*\] " nextgroup=todoItem skipwhite +highlight timeslot ctermfg=Magenta + +" A todoItem has a subject (e.g., a word that's followed by a ':') +syn match todoItem '\i\+:' contained +hi todoItem ctermfg=Blue + highlight link todoStatusDone PreProc highlight link todoStatusDoing PreProc highlight link todoStatusTodo PreProc diff --git a/.vimrc b/.vimrc index 14eb6f2..30ce750 100644 --- a/.vimrc +++ b/.vimrc @@ -6,6 +6,8 @@ set shell=/bin/bash +set encoding=utf-8 + " change the key from \ to , let mapleader="," @@ -67,15 +69,21 @@ Plugin 'jnurmine/Zenburn.git' " Quick file system tree, mapped to Ctrl+n for quick toggle Plugin 'scrooloose/nerdtree' map :NERDTreeToggle -let NERDTreeIgnore = ['\.pyc$'] +let NERDTreeIgnore = ['\.pyc$', 'tags'] " close vim if the only window left open is a NERDTree autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif +" Rooter changes the working directory to the project root when you open a +" file or directory. Useful when using fzf for example. +Plugin 'airblade/vim-rooter' +" Do not echo the project directory +let g:rooter_silent_chdir = 1 + + " Full path fuzzy file, buffer, mru, tag, ... finder " Quickly open files, fuzzy search on name Plugin 'ctrlpvim/ctrlp.vim' -"let g:ctrlp_map = 't' let g:ctrlp_map = '' " Search in Files, Buffers and MRU files at the same time: let g:ctrlp_cmd = 'CtrlPMixed' @@ -86,6 +94,24 @@ let g:ctrlp_working_path_mode = 0 let g:ctrlp_dotfiles = 0 let g:ctrlp_switch_buffer = 0 +" Run your favorite search tool from Vim, with an enhanced results list. +" Supports Silver Searcher `ag`. Use with: +" :Ack [options] {pattern} [{directories}] +Plugin 'mileszs/ack.vim' +" apt install silversearcher-ag +if executable('ag') + "let g:ackprg = 'ag --nogroup --nocolor --column' + let g:ackprg = 'ag --vimgrep' +endif + +" fzf integration for fast fuzzy finding, better and faster than ctrl-p +set rtp+=~/workspace/projects/others/fzf +Plugin 'junegunn/fzf.vim' +nmap ; :Buffers +nmap f :Files +nmap t :Tags +nmap c :Commits + " Web Development/Filetype icons " Needs a font like found at @@ -97,8 +123,22 @@ Plugin 'ryanoasis/vim-devicons' " == Content convenience ====== +" transparent editing of gpg encrypted files. The filename must have a .gpg, +" .pgp or .asc suffix. Plugin 'jamessan/vim-gnupg' +" tcomment provides easy to use, file-type sensible comments for Vim. It +" can handle embedded syntax. +Plugin 'tomtom/tcomment_vim' + +" Typescript syntax file and more +Plugin 'leafgarland/typescript-vim' +autocmd BufNewFile,BufRead *.ts setlocal filetype=typescript + +" handling column separated data (csv) +Plugin 'chrisbra/csv.vim' +autocmd BufNewFile,BufRead *.csv setlocal filetype=csv + " Automatically insert matching close bracket where it belongs "Plugin 'seletskiy/vim-autosurround' "inoremap ( (:call AutoSurround(")") @@ -148,17 +188,32 @@ set complete+=kspell " Also, vim-nox-py2 might be needed Plugin 'davidhalter/jedi-vim' "let g:jedi#force_py_version = 2 -let g:ycm_server_python_interpreter = '/usr/bin/python' +" For example in termux, ycm does not want to compile, don't load it there +" with ~/.dot_no_ycm +let skip_ycm=fnamemodify(expand("$MYVIMRC"), ":p:h") . "/.dot_no_ycm" +if !filereadable(skip_ycm) " Only load YouCompleteMe if ~/.dot_no_ycm does not exist " code-completion engine " sudo apt-get install build-essential cmake " sudo apt-get install python-dev " cd ~/.vim/bundle/YouCompleteMe " ./install.py # For C-style languages: ./install.py --clang-completer Plugin 'Valloric/YouCompleteMe' +" YouCompleteMe interpreter version (should be the same as what YCM was +" compiled with): +"let g:ycm_server_python_interpreter = '/usr/bin/python' +let g:ycm_server_python_interpreter = '/usr/bin/python3' +" Debug stuff +"let g:ycm_server_keep_logfiles = 1 +"let g:ycm_server_log_level = 'debug' +endif + +" Improved Django handling +Plugin 'tweekmonster/django-plus.vim' " Code checker. For python, install flake8 or pylint, preferably in the " virtualenv. For Django support, install pylint-django +"Disabled, using ALE instead (see below); the settings here are not needed "Plugin 'vim-syntastic/syntastic' set statusline+=%#warningmsg# set statusline+=%{SyntasticStatuslineFlag()} @@ -201,12 +256,16 @@ let g:ale_fixers = {} " Python specific settings let g:ale_fixers.python = ['isort'] " No silly 80-char line limit. Sorry pep-8. Also, Django support. Disable 'invalid name', 'missing docstring' -let g:ale_python_pylint_options="--max-line-length=120 -d C0103,C0111" +if exists('b:is_django') + let g:ale_python_pylint_options="--max-line-length=120 --load-plugins pylint_django --disable=invalid-name,missing-docstring" +else + let g:ale_python_pylint_options="--max-line-length=120 --disable=invalid-name,missing-docstring" +endif " Show errors or warnings in the statusline let g:airline#extensions#ale#enabled = 1 " UI -let g:ale_sign_error = '✗' -let g:ale_sign_warning = '⚠' +let g:ale_sign_error = 'x' +let g:ale_sign_warning = '>' " Handy Markdown stuff @@ -215,6 +274,9 @@ Plugin 'godlygeek/tabular' Plugin 'plasticboy/vim-markdown' " Do not fold markdown files by default let g:vim_markdown_folding_disabled = 1 +set nofoldenable +" Use filetype name as fenced code block languages for syntax highlighting +let g:vim_markdown_fenced_languages = ['c++=cpp', 'viml=vim', 'bash=sh', 'ini=dosini', 'python=python'] if v:version >= 704 " Pandoc, for stuff like autocompletion of citations from bibtex, other LaTeX @@ -222,8 +284,30 @@ if v:version >= 704 Plugin 'vim-pandoc/vim-pandoc' endif + " Distraction-free writing, start with V (\V or ,V in this config) -Plugin 'mikewest/vimroom' +Plugin 'junegunn/goyo.vim' +let g:goyo_width = 120 + +" Help focus on text by dimming other parts a bit +Plugin 'junegunn/limelight.vim' +let g:limelight_conceal_ctermfg = 'Grey69' +let g:limelight_conceal_ctermfg = 145 + +" Helps with writing prose (better line breaks, agnostic on soft line wraps vs +" hard line breaks etc) +Plugin 'reedes/vim-pencil' +" Disable automatic formatting, as this automatically merges lines devided by +" 1 hard enter only, which can be annoying +let g:pencil#autoformat = 0 + +" Do not insert hard line breaks in the middle of a sentence +let g:pencil#wrapModeDefault = 'soft' " default is 'hard' + +" Toggle Gogo with Limelight and Pencil together with Ctrl+F11 +"map :Goyo :Limelight!! :TogglePencil +nmap V :Goyo :Limelight!! :TogglePencil + " undotree.vim : Display your undo history in a graph. Plugin 'mbbill/undotree' @@ -254,15 +338,22 @@ Plugin 'lepture/vim-jinja' "Plugin 'chrisbra/csv.vim' " apparently doesn't work this way ;) " Automatic generation of tags file (ctags), in a central place (~/.vimtags) -Plugin 'xolox/vim-misc' -Plugin 'xolox/vim-easytags' +"Plugin 'xolox/vim-misc' +"Plugin 'xolox/vim-easytags' " easytags highlighting is slow -let g:easytags_auto_highlight = 0 +"let g:easytags_auto_highlight = 0 + +" Automatic generation of tags file (ctags: Exhuberant Ctags) +Plugin 'ludovicchabant/vim-gutentags' +" know when Gutentags is generating tags (prints 'TAGS' in status-line) +set statusline+=%{gutentags#statusline()} +let g:gutentags_ctags_exclude = ["*.min.js", "*.min.css", "build", "vendor", ".git", "node_modules", "*.vim/bundle/*"] " All of your Plugins must be added before the following line call vundle#end() " required filetype plugin indent on " required +"filetype plugin on " Enable line numbers, highlighting of current line and syntax highlighting by default set number @@ -309,7 +400,7 @@ set hidden set cryptmethod=blowfish2 " Ensure 256 colour support if the terminal supports it -if &term == "xterm" || &term == "xterm-256color" || &term == "screen-bce" || &term == "screen-256color" || &term == "screen" +if &term == "xterm" || &term == "xterm-256color" || &term == "screen-bce" || &term == "screen-256color" || &term == "screen" || &term == "tmux-256color-italic" set t_Co=256 colorscheme zenburn @@ -338,6 +429,9 @@ iab timeh strftime("## %Y%m%d %a %H:%M:%S") " Fly through buffers instead of cycling nnoremap l :ls:b +" Close Location windows, if exist, switch to the previous view buffer, and then close the last switched buffer. +nnoremap q :lcloseb#bd # + " Git and Mercurial 'blame' command. First select lines in visual modes, then " hit the appropriate leader key sequence (e.g., \g for git blame) " Update: For Git blame, just do :Gblame from vim-fugitive @@ -371,3 +465,7 @@ set autoindent " Django html template highlighting by default au BufNewFile,BufRead *.html set filetype=htmldjango + +" Italics +let &t_ZH = "\e[3m" +let &t_ZR = "\e[23m" diff --git a/README.md b/README.md index f3665e2..486461f 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,16 @@ dotfiles ======== -After having my homedirs in subversion for years, move to Git. +After having my homedirs in subversion for years, moved this collection to Git in 2014 and standardised over all my machines. + +To install: ``` mkdir ~/.dot cd ~/.dot clone cd dotfiles # this takes you to the freshly cloned ~/.dot/dotfiles -sh install.sh # install the files in the homedir +sh install.sh # follow the instructions and install the files in the homedir ``` # Fix for shift+F6 in tmux (and screen probably) @@ -17,7 +19,7 @@ In tmux, do `infocmp > screen-256color`. Add the line `kf16=\E[17;2~,` and compi # ~/.git_repos config file -The update_repos script takes the ~/.git_repos config file and lets you update and clone your projects automatically (or at least in a batch). In the example the first four repos are located in ~/workspace/projects/github, and the other two in workspace/projects/others and workspace/projects/private respectively; then the workspace and group are empty, so mydocs is cloned into the homedir. At the moment, only paths relative to the user's homedir are supported. +The `update_repos` script takes the `~/.git_repos` config file and lets you update and clone your projects automatically (or at least in a batch). In the example the first four repos are located in ~/workspace/projects/github, and the other two in workspace/projects/others and workspace/projects/private respectively; then the workspace and group are empty, so mydocs is cloned into the homedir. At the moment, only paths relative to the user's homedir are supported. ``` workspace=workspace/projects @@ -38,3 +40,20 @@ workspace= group= ssh://myserver/srv/git/mydocs.git ``` + +# Interesting scripts + +| ./bin/ | description | +|------------------|-----------------------------------------------------------------------------------------| +| calibre_update | Update (or install) ebook manager Calibre | +| clean_mac_files | Remove those DS_Store and other dirs | +| clean_project | Remove compiled Python files, vim swp files | +| clean_pyc | Remove compiled Python files | +| fixpermissions | chmod dirs to 755, files to 644 | +| fixpictimestamps | Change file ctime to datetime from EXIF | +| fontupdate | Update nerd-fonts; whole repo on server, link font files to ~/.local/share/fonts | +| fuz | Simple note-taking 'app' based on FZF and vim | +| git_autosave | Simple script to call from crontab or something to commit certain files in Git and push | +| git_clean | Clean the Git tree | +| sorter | Sort files in newly created subdirectories, based on pre- or postfixes | +| update_repos | Update a bunch of Git repos at once, like all your project. Config with ~/.git_repos | diff --git a/bin/clean_project b/bin/clean_project new file mode 100755 index 0000000..0b29553 --- /dev/null +++ b/bin/clean_project @@ -0,0 +1,12 @@ +#!/bin/bash +read -p "Close vim and stop running (Python) processes. Type 'c' to continue after doing so, any other key to abort. " -n 1 -r +echo # (optional) move to a new line +if [[ $REPLY =~ ^[Cc]$ ]] +then + # do semi-dangerous stuff + find . -name "*.pyc" -type f -delete + find . -name "*.swp" -type f -delete + find . -name "*.swo" -type f -delete +else + echo "aborted" +fi diff --git a/bin/fuz b/bin/fuz new file mode 100755 index 0000000..88f5933 --- /dev/null +++ b/bin/fuz @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# Taken from https://medium.com/adorableio/simple-note-taking-with-fzf-and-vim-2a647a39cfa + +set -e + +main() { + previous_file="$1" + file_to_edit=`select_file $previous_file` + + if [ -n "$file_to_edit" ] ; then + "${EDITOR:-vim}" "$file_to_edit" + main "$file_to_edit" + fi +} + +select_file() { + given_file="$1" + fzf --preview="cat {}" --preview-window=right:70%:wrap --query="$given_file" +} + +main "" diff --git a/bin/git_autosave b/bin/git_autosave index 4a40bfa..eb03518 100755 --- a/bin/git_autosave +++ b/bin/git_autosave @@ -2,18 +2,13 @@ if [ -n "$1" ]; then FIRSTFILE=$1 - #echo $! - GITDIR=$(dirname ${FIRSTFILE}) - #echo $GITDIR - cd $GITDIR - DATETIME=`date +%Y%m%d\ %H:%M:%S` - #echo $DATETIME + GITDIR=$(dirname "${FIRSTFILE}") + cd "$GITDIR" || exit + DATETIME=$(date +%Y%m%d\ %H:%M:%S) #git pull - RESULT=`git commit $* -m "Autosave at $DATETIME"` - echo $RESULT + RESULT=$(git commit $* -m "Autosave at $DATETIME") + echo "$RESULT" #zenity --info --text=$RESULT - #echo $? - #echo "git commit $* -m 'Autosave at $DATETIME'" git push else diff --git a/bin/logfileinfo b/bin/logfileinfo new file mode 100755 index 0000000..d39b2af --- /dev/null +++ b/bin/logfileinfo @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +from urllib.parse import urlparse + +domains = {} +privacy_domains = {} + +#with open('consent_20180227_1055.log', encoding='latin1') as pf: +with open('logfile.log') as pf: + logdata = pf.readlines() + + for line in logdata: + url = line.split(' ')[10] + url = url[1:-1] # Strip quotes + domain = urlparse(url).netloc + if domain not in domains: + domains[domain] = 0 + domains[domain] += 1 + + url = line.split(' ')[6] + #print(url) + domain = urlparse(url).netloc + if domain not in privacy_domains: + privacy_domains[domain] = 0 + privacy_domains[domain] += 1 + +print('== Referrers ======') +for key in sorted(domains, key=domains.__getitem__, reverse=True): + print('{:6} {}'.format(domains[key], key)) + +print() +print('== Domains ======') +for key in sorted(privacy_domains, key=privacy_domains.__getitem__, reverse=True): + print('{:6} {}'.format(privacy_domains[key], key)) diff --git a/bin/sanomanotes b/bin/sanomanotes index 2d3e95f..7894d98 100755 --- a/bin/sanomanotes +++ b/bin/sanomanotes @@ -2,4 +2,4 @@ cd ~/mydocs/work/sanoma git pull #vim -c ":vsp planning_2015.todo" notes_2015.md notes_2014.md -vim -c "set nofoldenable" planning_2017.todo cs_notes.md cs_howtos.md dcp_notes.md dcp_howtos.md +vim -c "set nofoldenable" planning_2018.todo cs_notes.md cs_howtos.md dcp_notes.md dcp_howtos.md planning_2017.todo