diff --git a/.bash_aliases b/.bash_aliases index 7cda729..ac40dd3 100644 --- a/.bash_aliases +++ b/.bash_aliases @@ -1,7 +1,22 @@ PATH=$PATH:~/bin -alias ls='ls --color=auto' -alias ll='ls -la' +# 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 dir='dir --color=auto' + #alias vdir='vdir --color=auto' + + alias grep='grep --color=auto' + alias fgrep='fgrep --color=auto' + alias egrep='egrep --color=auto' +fi + +# some more ls aliases +alias ll='ls -alF' +alias la='ls -A' +alias l='ls -CF' +alias lll='ls --color=always -alF | less -R' # append history instead of overwriting: shopt -s histappend @@ -13,8 +28,15 @@ alias findpy='find . -name "*.py" | xargs grep' alias findfile='find . | grep -v .svn | grep -v .hg | grep -v .git | grep' +# 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$//'\'')"' + alias notes='vim ~/mydocs/notes/notes.txt' +# 20141202 +alias captainslog='vim ~/mydocs/notes/captains_log.md' + # Some hosts alias higgs='ssh higgs' alias medusa='ssh medusa' @@ -36,6 +58,27 @@ alias so=git # so rebase # so diff +alias gd='git diff' +alias gc='git commit' +alias gca='git commit -a' +alias gst='git status' +alias gp='git push' +# git activity per week day: +# git log --pretty='%at' | while read d; do date -d "@$d"; done | awk '{print $1}' | sort | uniq -c +alias gad='git log --pretty='"'"'%at'"'"' | while read d; do date -d "@$d"; done | awk '"'"'{print $1}'"'"' | sort | uniq -c' +# git activity per hour of the day: +# git log --pretty='%at' | while read d; do date +%H -d "@$d"; done | sort | uniq -c +alias gah='git log --pretty='"'"'%at'"'"' | while read d; do date +%H -d "@$d"; done | sort | uniq -c' + +# mercurial coloured diff +alias hgd='hg diff | colordiff -y | less -R' +# some more shorthands +alias hgl='hg log | less' +alias hgb='hg branch' +alias hgt='hg tags | less' +alias hgu='hg pull -u' +alias hgp='hg push' + # 20140521 force 256 colours in tmux alias tmux='tmux -2' @@ -49,6 +92,18 @@ alias pip_upgrade="pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs # 20140908 reload tmux config alias tmux_reload="tmux source-file ~/.tmux.conf" +# project-oriented aliases +alias dcpvag='workon dcp; cd ~/workspace/sanoma/content-library/; vagrant ssh' +alias dcpsrc='cd ~/development/current/content-library/src/content_library/; . ~/development/env/bin/activate' +alias dcpcelery='python manage.py celery worker -Q celery -l info' + +# update/install Calibre ebook manager +alias updatecalibre='sudo -v && wget -nv -O- https://raw.githubusercontent.com/kovidgoyal/calibre/master/setup/linux-installer.py | sudo python -c "import sys; main=lambda:sys.stderr.write('"'"'Download failed\n'"'"'); exec(sys.stdin.read()); main()"' + +# Watch a DNS entry, see when it changes to a new value for example +alias checkdns='watch -n1 dig ' + +# if you're really annoyed with a runaway process function fuck() { if killall -9 "$2"; then echo ; echo " (╯°□°)╯︵$(echo "$2"|toilet -f term -F rotate)"; echo diff --git a/.bashrc b/.bashrc index 345344d..649b9e8 100644 --- a/.bashrc +++ b/.bashrc @@ -56,6 +56,46 @@ if [ -n "$force_color_prompt" ]; then fi fi +# http://stackoverflow.com/questions/4023830/bash-how-compare-two-strings-in-version-format +# returns 0 if =, 1 if >, 2 if < +vercomp () { + if [[ $1 == $2 ]] + then + return 0 + fi + local IFS=. + local i ver1=($1) ver2=($2) + # fill empty fields in ver1 with zeros + for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)) + do + ver1[i]=0 + done + for ((i=0; i<${#ver1[@]}; i++)) + do + if [[ -z ${ver2[i]} ]] + then + # fill empty fields in ver2 with zeros + ver2[i]=0 + fi + if ((10#${ver1[i]} > 10#${ver2[i]})) + then + return 1 + fi + if ((10#${ver1[i]} < 10#${ver2[i]})) + then + return 2 + fi + done + return 0 +} + +# check version of git; it supports 'simple' from 1.7.11 up, fall back to 'matching' +vercomp "1.7.11" `git --version|awk '{ print $3 }'` +if [ $? -eq 1 ]; then + git config --global push.default matching + git config --global pull.default matching +fi + hg_ps1() { #hg prompt "{ on {branch}}{ at {bookmark}}{status}" 2> /dev/null hg prompt " \[\033[1;37m\]hg\[\033[0m\] {branch}{status}" 2> /dev/null @@ -71,13 +111,13 @@ set_bash_prompt(){ PROMPT_SYMBOL='$' if [ $USER = 'root' ]; then #PS1="$YELLOW\t $RED\u$BLACK@\h:\W# " - PS1="$YELLOW\t $RED\u$BLACK@\h:\W$(jobscount)# " + PS1="${debian_chroot:+$debian_chroot }$(venvinfo)$YELLOW\t $RED\u$BLACK@\h:\W$(jobscount)# " elif [ -e ~/.dot_is_server ]; then #PS1="$YELLOW\t $GREEN\u$BLACK@\h:\W$ " - PS1="$YELLOW\t $GREEN\u$BLACK@\h:\W$(jobscount)$ " + PS1="${debian_chroot:+$debian_chroot }$(venvinfo)$YELLOW\t $GREEN\u$BLACK@\h:\W$(jobscount)$ " else #PS1="$YELLOW\t $BLUE\u$BLACK@\h:\W$ " - PS1="$YELLOW\t $BLUE\u$BLACK@\h:\W$(jobscount)$ " + PS1="${debian_chroot:+$debian_chroot }$(venvinfo)$YELLOW\t $BLUE\u$BLACK@\h:\W$(jobscount)$ " fi #PS1="$YELLOW\t $BLUE\u$BLACK@\h:\W$(hg_ps1)$ " #PS1="$YELLOW\t $BLUE\u$BLACK@\h:\W$(hg_ps1)$(__git_ps1)$ " @@ -85,11 +125,23 @@ set_bash_prompt(){ } jobscount() { + # Show amount of running and stopped (backgrounded) jobs local stopped=$(jobs -sp | wc -l) local running=$(jobs -rp | wc -l) ((running+stopped)) && echo -n "[${running}r/${stopped}s]" } +venvinfo() { + # Virtualenv information + if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then + # special case for Aspen magic directories + # see http://www.zetadev.com/software/aspen/ + echo "[`basename \`dirname \"$VIRTUAL_ENV\"\``] " + elif [ "$VIRTUAL_ENV" != "" ]; then + echo "(`basename \"$VIRTUAL_ENV\"`) " + fi +} + # gitprompt configuration # Set config variables first #GIT_PROMPT_ONLY_IN_REPO=1 @@ -114,32 +166,10 @@ xterm*|rxvt*) ;; 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 dir='dir --color=auto' - #alias vdir='vdir --color=auto' - - alias grep='grep --color=auto' - alias fgrep='fgrep --color=auto' - alias egrep='egrep --color=auto' -fi - -# some more ls aliases -alias ll='ls -alF' -alias la='ls -A' -alias l='ls -CF' - -# 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$//'\'')"' - # Alias definitions. # You may want to put all your additions into a separate file like # ~/.bash_aliases, instead of adding them here directly. # See /usr/share/doc/bash-doc/examples in the bash-doc package. - if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi @@ -155,8 +185,10 @@ if [ -f /etc/bash_completion ] && ! shopt -oq posix; then . /etc/bash_completion fi +# If the private dotfiles repo is installed, we'd like to use its scripts too if [ -x ~/.dot/privdotfiles/bin ]; then PATH=$PATH:~/.dot/privdotfiles/bin fi -PATH=$PATH:/usr/local/bin/android-sdk-linux/platform-tools +# Android-related binaries +PATH=$PATH:/usr/local/bin/android-sdk-linux/platform-tools:/usr/local/bin/android-sdk-linux/tools diff --git a/.gitconfig b/.gitconfig index 723ed7f..e371364 100644 --- a/.gitconfig +++ b/.gitconfig @@ -1,6 +1,6 @@ [user] name = Michiel Scholten - email = michiel@aquariusoft.org + email = michiel@diginaut.net [giggle] main-window-maximized = true diff --git a/.hgrc b/.hgrc index cdbd218..6797cb9 100644 --- a/.hgrc +++ b/.hgrc @@ -7,7 +7,7 @@ username = m.scholten hgext.mercurial_keyring = ~/workspace/application_addons/mercurial/mercurial_keyring/mercurial_keyring.py convert = hgext.bookmarks = -graphlog = +graphlog = hgext.purge= hgk= hgflow = ~/workspace/application_addons/mercurial/hgflow/src/hgflow.py diff --git a/.tmux.conf b/.tmux.conf index 2b962b2..9a2f227 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -86,5 +86,37 @@ set -g history-limit 10000 # Fix for shift-keys with Fn; needs correct terminfo too setw -g xterm-keys on +# Mouse support for resizing and selecting panes +set -g mode-mouse on +set -g mouse-resize-pane on +set -g mouse-select-pane on +set -g mouse-select-window on + +# toggle mouse mode to allow mouse copy/paste +# set mouse on with prefix m +bind m \ + set -g mode-mouse on \;\ + set -g mouse-resize-pane on \;\ + set -g mouse-select-pane on \;\ + set -g mouse-select-window on \;\ + display 'Mouse: ON' +# set mouse off with prefix M +bind M \ + set -g mode-mouse off \;\ + set -g mouse-resize-pane off \;\ + set -g mouse-select-pane off \;\ + set -g mouse-select-window off \;\ + display 'Mouse: OFF' +# zoom this pane to full screen +bind + \ + new-window -d -n tmux-zoom 'clear && echo TMUX ZOOM && read' \;\ + swap-pane -s tmux-zoom.0 \;\ + select-window -t tmux-zoom +# restore this pane +bind - \ + last-window \;\ + swap-pane -s tmux-zoom.0 \;\ + kill-window -t tmux-zoom + # Local config if-shell "[ -f ~/.tmux.conf.user ]" 'source ~/.tmux.conf.user' diff --git a/.vim/ftdetect/eyaml.vim b/.vim/ftdetect/eyaml.vim new file mode 100644 index 0000000..0419cd5 --- /dev/null +++ b/.vim/ftdetect/eyaml.vim @@ -0,0 +1 @@ +autocmd BufWinEnter *.{eyaml} silent setf yaml diff --git a/.vim/ftdetect/todo.vim b/.vim/ftdetect/todo.vim new file mode 100644 index 0000000..af40649 --- /dev/null +++ b/.vim/ftdetect/todo.vim @@ -0,0 +1 @@ +au BufNewFile,BufRead *.todo set filetype=todo diff --git a/.vim/spell/en.utf-8.add b/.vim/spell/en.utf-8.add new file mode 100644 index 0000000..1c6acce --- /dev/null +++ b/.vim/spell/en.utf-8.add @@ -0,0 +1,2 @@ +Webistrano +smartwatch diff --git a/.vim/spell/en.utf-8.add.spl b/.vim/spell/en.utf-8.add.spl new file mode 100644 index 0000000..446e763 Binary files /dev/null and b/.vim/spell/en.utf-8.add.spl differ diff --git a/.vim/spell/nl.utf-8.add b/.vim/spell/nl.utf-8.add new file mode 100644 index 0000000..28c50d6 --- /dev/null +++ b/.vim/spell/nl.utf-8.add @@ -0,0 +1,17 @@ +scrumboard +todo +enzo +backups +Nexus +m'n +energielabels +Nuon +BHV +Finke +BTW-aangifte +Scholten +Sen +NLLGG +ALV +Soleus +Wietse diff --git a/.vim/spell/nl.utf-8.add.spl b/.vim/spell/nl.utf-8.add.spl new file mode 100644 index 0000000..dc16038 Binary files /dev/null and b/.vim/spell/nl.utf-8.add.spl differ diff --git a/.vim/spell/nl.utf-8.spl b/.vim/spell/nl.utf-8.spl new file mode 100644 index 0000000..14ec811 Binary files /dev/null and b/.vim/spell/nl.utf-8.spl differ diff --git a/.vim/spell/nl.utf-8.sug b/.vim/spell/nl.utf-8.sug new file mode 100644 index 0000000..3191f5e Binary files /dev/null and b/.vim/spell/nl.utf-8.sug differ diff --git a/.vim/syntax/todo.vim b/.vim/syntax/todo.vim new file mode 100644 index 0000000..af91bf7 --- /dev/null +++ b/.vim/syntax/todo.vim @@ -0,0 +1,58 @@ +if exists("b:current_syntax") + finish +endif + + +" Keywords that we want to emphasize +syntax keyword todoKeyword todo done +syntax keyword todoKeyword vrij free +highlight link todoKeyword Keyword + + +" Inline commenting +syntax match todoComment "\v#.*$" +highlight link todoComment Comment + + +" Heading (day) delimiters +syn region todoDay matchgroup=todoHeadingDelimiter start="==\@!" end="==*\s*$" keepend oneline + +hi def link todoHeadingDelimiter Delimiter + + +" Generic operators +syntax match todoOperator "\v\*" +syntax match todoOperator "\v/" +syntax match todoOperator "\v\+" +syntax match todoOperator "\v-" + +highlight link todoOperator Operator + + +" Task statuses +syntax match todoStatusDone "\v^v " +syntax match todoStatusDone "\v v " +syntax match todoStatusDone "\v^x " +syntax match todoStatusDone "\v x " +highlight todoStatusDone ctermfg=green guifg=#00ff00 + +syntax match todoStatusDoing "\v^d " +syntax match todoStatusDoing "\v d " +"highlight todoStatusDoing ctermfg=DarkOrange guifg=#ffcc00 +highlight todoStatusDoing ctermfg=DarkYellow guifg=#ffcc00 + +syntax match todoStatusTest "\v^t " +syntax match todoStatusTest "\v t " +highlight todoStatusTest ctermfg=darkcyan guifg=#6666ff + +syntax match todoStatusTodo "\v^- " +syntax match todoStatusTodo "\v - " +highlight todoStatusTodo ctermfg=red guifg=#ff0000 + +highlight link todoStatusDone PreProc +highlight link todoStatusDoing PreProc +highlight link todoStatusTodo PreProc + + +" Syntax highlighting scheme name +let b:current_syntax = "todo" diff --git a/.vimrc b/.vimrc index f5b7d7e..8639cae 100644 --- a/.vimrc +++ b/.vimrc @@ -31,6 +31,7 @@ Plugin 'jnurmine/Zenburn.git' " Quick file system tree, mapped to Ctrl+n for quick toggle Plugin 'scrooloose/nerdtree' map :NERDTreeToggle +let NERDTreeIgnore = ['\.pyc$'] " close vim if the only window left open is a NERDTree autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif @@ -47,8 +48,50 @@ let g:ctrlp_switch_buffer = 0 " == Content convenience ====== +" Spell Check (http://vim.wikia.com/wiki/Toggle_spellcheck_with_function_keys) +let b:myLang=0 +let g:myLangList=["nospell","nl","en_gb","en_us"] +function! ToggleSpell() + let b:myLang=b:myLang+1 + if b:myLang>=len(g:myLangList) | let b:myLang=0 | endif + if b:myLang==0 + setlocal nospell + else + execute "setlocal spell spelllang=".get(g:myLangList, b:myLang) + endif + echo "spell checking language:" g:myLangList[b:myLang] +endfunction + +nmap :call ToggleSpell() + +" In case the spelling language was set by other means than ToggleSpell() (a filetype autocommand say): +if !exists( "b:myLang" ) + if &spell + let b:myLang=index(g:myLangList, &spelllang) + else + let b:myLang=0 + endif +endif + +" Word completion +set complete+=kspell + " Python autocompletion Plugin 'davidhalter/jedi-vim' +" Code checker. For python, install flake8 or pylint, preferably in the +" virtualenv. For Django support, install pylint-django +Plugin 'scrooloose/syntastic' +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 + +" No silly 80-char line limit. Sorry pep-8. Also, Django support. +let g:syntastic_python_pylint_post_args="--max-line-length=120 --load-plugins pylint_django" " Handy Markdown stuff Plugin 'tpope/vim-markdown' if v:version >= 704 @@ -84,6 +127,10 @@ set dictionary+=/usr/share/dict/words " use ctrl-n ctrl-n instead of ctrl-x ctrl-k set complete-=k complete+=k +" ctags: check the current folder for tags file and keep going one directory up +" all the way to the homedir +set tags=./tags,./TAGS,tags;~,TAGS;~ + " ignorecase plus smartcase make searches case-insensitive except when you " include upper-case characters (so /foo matches FOO and fOo, but /FOO only " matches the former) @@ -113,6 +160,20 @@ map jt :%!json_xs -f json -t json-pretty " Fly through buffers instead of cycling nnoremap l :ls:b +" Git and Mercurial 'blame' command. First select lines in visual modes, then +" hit the appropriate leader key sequence (e.g., \g for git blame) +vmap g :!git blame =expand("%:p") \| sed -n =line("'<") ,=line("'>") p +vmap h :!hg blame -fu =expand("%:p") \| sed -n =line("'<") ,=line("'>") p + + +" Enables input of special characters by a combination of two characters. +" Example: Type 'a', erase it by typing CTRL-H - and then type ':' - this +" results in the umlaut: ä So Vim remembers the character you have erased and +" combines it with the character you have typed "over" the previous one. +"set digraph +" Disabled as it also works with backspace and gives odd results with some +" normal typing, giving asiatic glyphs and such. Just use CTRL+k a: + " 2014-01-29 some sane Python settings autocmd FileType python set tabstop=4 autocmd FileType python set shiftwidth=4 @@ -121,6 +182,9 @@ autocmd FileType python set expandtab autocmd FileType python set softtabstop=4 autocmd FileType python set autoindent +" Django html template highlighting by default +au BufNewFile,BufRead *.html set filetype=htmldjango + " 2014-01-29 some sane PHP settings autocmd FileType php set tabstop=4 autocmd FileType php set shiftwidth=4 @@ -152,3 +216,11 @@ autocmd FileType markdown set smarttab autocmd FileType markdown set expandtab autocmd FileType markdown set softtabstop=4 autocmd FileType markdown set autoindent + +" 2015-01-13 some sane Yaml settings +autocmd FileType yaml set tabstop=4 +autocmd FileType yaml set shiftwidth=4 +autocmd FileType yaml set smarttab +autocmd FileType yaml set expandtab +autocmd FileType yaml set softtabstop=4 +autocmd FileType yaml set autoindent diff --git a/bin/cron/load_log b/bin/cron/load_log new file mode 100755 index 0000000..80850c7 --- /dev/null +++ b/bin/cron/load_log @@ -0,0 +1,13 @@ +#!/bin/bash +LOADAVG=$( cat /proc/loadavg | awk '{ print $2 }' ) + +MONTH=`date +%Y-%m` +DATE=`date +%Y-%m-%d` + +LOG="/var/log/custom_logs/cpu/load_$MONTH.log" +TIMESTAMP=`date +%Y%m%d_%H%M` +echo "${TIMESTAMP} $LOADAVG" >> ${LOG} + +LOG="/var/log/custom_logs/temp_daily/cpu/load_$DATE.log" +TIMESTAMP=`date "+%Y%m%d %H%M"` +echo "${TIMESTAMP} $LOADAVG" >> ${LOG} diff --git a/bin/cron/temperature_hdd_log b/bin/cron/temperature_hdd_log new file mode 100755 index 0000000..e1d9cd0 --- /dev/null +++ b/bin/cron/temperature_hdd_log @@ -0,0 +1,37 @@ +#!/bin/bash +#temperature: 23 C + +#TEMPERATURE=`awk '{print $2}' /proc/acpi/thermal_zone/THRM/temperature` +MONTH=`date +%Y-%m` +DATE=`date +%Y-%m-%d` +for HDD in sda sdb sdc sdd sde sdf sdg +do + #TEMPERATURE=`awk '{print $NF}' /root/tmp/hddtemp` + if [ "$HDD" == "sdb" ]; then + TEMPERATURE=`/usr/sbin/smartctl -A /dev/${HDD} | grep \ Temperature_Cel | awk '{print $10}'` + else + TEMPERATURE=`/usr/sbin/smartctl -A /dev/${HDD} | grep Temperature_Cel | awk '{print $10}'` + fi + #if [ "$HDD" == "sde" ]; then + # TEMPERATURE=`/usr/sbin/smartctl -A /dev/sde | grep Temperature_Cel | awk '{print $10}'` + #elif [ "$HDD" == "sdf" ]; then + # TEMPERATURE=`/usr/sbin/smartctl -A /dev/sdf | grep Temperature_Cel | awk '{print $10}'` + #elif [ "$HDD" == "sdc" ]; then + # TEMPERATURE=`/usr/sbin/smartctl -A /dev/sdc | grep Temperature_Cel | awk '{print $10}'` + #elif [ "$HDD" == "sdd" ]; then + # TEMPERATURE=`/usr/sbin/smartctl -A /dev/sdd | grep Temperature_Cel | awk '{print $10}'` + #else + # RAWTEMP=`/usr/sbin/hddtemp /dev/$HDD` + # #echo $RAWTEMP + # TEMPERATURE=`echo $RAWTEMP | awk '{print $NF}' | sed 's/°C//g'` + #fi + LOG="/var/log/custom_logs/hdd/temperature_${HDD}_${MONTH}.log" + TIMESTAMP=`date "+%Y%m%d %H%M"` + echo "${TIMESTAMP} $TEMPERATURE" >> ${LOG} + #echo "${HDD} ${TIMESTAMP} $TEMPERATURE" + #echo "${TIMESTAMP} $TEMPERATURE" + + LOG="/var/log/custom_logs/temp_daily/hdd/temperature_${HDD}_${DATE}.log" + #TIMESTAMP=`date "+%Y%m%d %H%M"` + echo "${TIMESTAMP} $TEMPERATURE" >> ${LOG} +done diff --git a/bin/cron/temperature_log b/bin/cron/temperature_log new file mode 100755 index 0000000..a5aa134 --- /dev/null +++ b/bin/cron/temperature_log @@ -0,0 +1,24 @@ +#!/bin/bash +#temperature: 23 C + +SENSORDATA=$(sensors 2>&1) + +TEMPERATURE="$(grep -i 'Core 0' <<< "${SENSORDATA}" | \ + grep -Eo '[0-9\.]+[[:punct:]]?[ ]?[CF]+' | head -n 1 | \ + sed 's/.\([CF]\)/\1/' | sed 's/C//' )" + +#TEMPERATURE=`awk '{print $2}' /proc/acpi/thermal_zone/THRM/temperature` +MONTH=`date +%Y-%m` +DATE=`date +%Y-%m-%d` +#TOTAL=`awk '{a+=$8}END{print a}' /var/log/custom_logs/temperature.log` +#LINES=`wc -l /var/log/custom_logs/temperature.log | awk '{print $1}'` +#MON=`date +%B` +#m=`wc -l /tmp/temp5_minutes | awk '{print $1}'` + +LOG="/var/log/custom_logs/cpu/temperature_$MONTH.log" +TIMESTAMP=`date +%Y%m%d_%H%M` +echo "${TIMESTAMP} $TEMPERATURE" >> ${LOG} + +LOG="/var/log/custom_logs/temp_daily/cpu/temperature_$DATE.log" +TIMESTAMP=`date "+%Y%m%d %H%M"` +echo "${TIMESTAMP} $TEMPERATURE" >> ${LOG} diff --git a/bin/fixpictimestamps b/bin/fixpictimestamps new file mode 100755 index 0000000..3e1fe65 --- /dev/null +++ b/bin/fixpictimestamps @@ -0,0 +1,14 @@ +#!/bin/bash +find -name '*.jpg' | while read PIC; do +DATE=$(exiftool -p '$DateTimeOriginal' $PIC | sed 's/[: ]//g') +echo "$DATE $PIC" +touch -t $(echo $DATE | sed 's/\(..$\)/\.\1/') $PIC +#mv -i $PIC $(dirname $PIC)/$DATE.jpg +done + +find -name '*.CR2' | while read PIC; do +DATE=$(exiftool -p '$DateTimeOriginal' $PIC | sed 's/[: ]//g') +echo "$DATE $PIC" +touch -t $(echo $DATE | sed 's/\(..$\)/\.\1/') $PIC +#mv -i $PIC $(dirname $PIC)/$DATE.jpg +done diff --git a/bin/icons_ozon b/bin/icons_ozon new file mode 100755 index 0000000..3255c74 --- /dev/null +++ b/bin/icons_ozon @@ -0,0 +1,14 @@ +#!/bin/bash +#mydir=$(mktemp -dt "$0") +#mydir=$(mktemp -d "$TMPDIR/$(basename $0).XXXXXXXXXX") +mydir=$(mktemp -d "/tmp/$(basename $0).XXXXXXXXXX") + +cd $mydir +pwd +wget https://github.com/ozonos/ozon-icon-theme/archive/master.zip +unzip -q master.zip +if [ -e /usr/share/icons/Ozon.prev ]; then + sudo rm -rf /usr/share/icons/Ozon.prev +fi +sudo mv /usr/share/icons/Ozon /usr/share/icons/Ozon.prev +sudo mv ozon-icon-theme-master/Ozon /usr/share/icons/ diff --git a/bin/portuser b/bin/portuser new file mode 100755 index 0000000..fb7d6b8 --- /dev/null +++ b/bin/portuser @@ -0,0 +1,6 @@ +#!/bin/bash +if [ -z "$1" ]; then + echo "Provide a TCP port number" +else + sudo fuser -v $1/tcp +fi diff --git a/bin/randomhex b/bin/randomhex new file mode 100755 index 0000000..7d9d38e --- /dev/null +++ b/bin/randomhex @@ -0,0 +1,8 @@ +#!/bin/bash +if [ -e $1 ]; then + NUMBERCHARS=42 +else + NUMBERCHARS=$1 +fi + +cat /dev/urandom | tr -cd 'a-f0-9' | head -c $NUMBERCHARS ; echo diff --git a/bin/sanomanotes b/bin/sanomanotes index a17accc..84422ef 100755 --- a/bin/sanomanotes +++ b/bin/sanomanotes @@ -1,4 +1,4 @@ #!/bin/bash cd ~/mydocs/work/sanoma git pull -vim -c ":vsp planning_2014.txt" sprints_2014.txt notes_2014.md +vim -c ":vsp planning_2015.todo" notes_2015.md notes_2014.md