Skip to content

Instantly share code, notes, and snippets.

@neulaender
neulaender / basename-without-basename.sh
Created April 19, 2017 21:42
Give back only the basename without using "basename"
# Give back only the basename without using `basename` (i.e. in scripts)
filestring=blurps.pdf
echo ${file%.pdf}
@neulaender
neulaender / compress.sh
Created April 19, 2017 21:40
Compress PDFs in bash
# compress PDF. Needs ghostscript package.
gs -sDEVICE=pdfwrite -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -DBATCH -sOutputFile=out.pdf in.pdf
# compress all PDFs in dir
for file in `ls *.pdf`;
do
gs -sDEVICE=pdfwrite -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -DBATCH -sOutputFile=${$file%.pdf}-c.pdf $file
done
@neulaender
neulaender / grepNotEmptyLine
Created March 28, 2016 18:32
Remove empty lines from output/input in bash/zsh.
grep -v '^$' #remove empty lines
@neulaender
neulaender / .vimrc
Created March 26, 2016 12:59
Working vanilla/pluginless vim dotfile.
" Use the bash instead of my standard shell as most scripts are based on it
set shell=/bin/bash
set t_Co=256 " 256 color mode
set encoding=utf-8 " always use utf-8
set mouse=a " enable mouse usage
set nocompatible " should be auto-on, but to be sure...
set number " Numbering on left side.
set relativenumber " Sets numbers relative to the current line
au InsertEnter * :set nu " Enter absolute number mode in insert mode
au InsertLeave * :set rnu " relative ... in normal mode