custom python3.x install (on mint)

follow instructions from: http://grahamwideman.wikispaces.com/Python-+Installation+on+Linux

note the following:

  • use (latest) python version that you want
  • use configure prefix path valid for your version
  • make install for adding binaries to /bin (adding to $PATH variable) and make altinstall for side-by-side install
  • create link:
    ln -s /opt/python3.5/bin/python3.5 /usr/local/bin/python3.5
  • need to compile libraries as well… to be continued

bash extract function

it’s convenient to define this function in your bashrc, s.t. you dont have to think of all the different file formats while extracting.

source: https://coderwall.com/p/agmblq/bash-function-for-extract-every-archive-with-one-word


function extract()
{
     if [ -f $1 ] ; then
         case $1 in
            *.tar.bz2)   
                tar xvjf $1     
                ;; 
            *.tar.xz)
                tar xvJf $1
                ;;
            *.tar.gz)    
                tar xvzf $1     
                ;;
            *.bz2)       
                bunzip2 $1      
                ;;
            *.rar)
                unrar x $1      
                ;;
            *.gz)
                gunzip $1       
                ;;
            *.tar)
                tar xvf $1      
                ;;
            *.tbz2)
                tar xvjf $1     
                ;;
            *.tgz)
                tar xvzf $1     
                ;;
            *.zip)
                unzip $1        
                ;;
            *.Z)
                uncompress $1   
                ;;
            *.7z)
                7z x $1         
                ;;
            *)  
                echo "'$1' cannot be extracted via extract" 
                ;;
        esac
    else
        echo "'$1' is not a valid file"
    fi
}

pdf editing

install the following program: pdftk

  • simple cutting: pdftk myDocument.pdf cat 1-9 26-end output removedPages.pdf
  • cutting multiple files: pdftk A=one.pdf B=two.pdf cat A1-7 B1-5 A8 output combined.pdf
  • viewing + editing pdf metadata:
    • view: pdftk input.pdf dump_data output metadata.txt
    • edit: vim metadata.txt
    • make consistent: pdftk input.pdf update_info metadata.txt output output.pdf

https://www.pdflabs.com/docs/pdftk-cli-examples/

https://www.maketecheasier.com/combine-multiple-pdf-files-with-pdftk/

http://www.onurguzel.com/changing-pdf-metadata-under-linux/

Create random + pronouncable passwords on linux

$ pwgen

pwgen is another utility that is just a quick installation away with the command sudo apt-get install pwgen. Simply running the command pwgen will flood your terminal with many passwords, so you’re just supposed to pick one at random (preferrably not the first or last one). This is done in case someone is nearby or looking over your shoulder — that way they won’t know which password you’ve chosen out of the many that are displayed.

You can also use these flags:

  • -1: Gives you just one password rather than an entire screen full of them.
  • -s: Uses a different algorithm to make it even more secure.
  • -y: Add special characters to the provided password.
  • -0: Don’t include numbers.
  • -B: Don’t use characters that are hard to read, such as 1 I l or 0 O
  • -v: Don’t allow any vowels. This is primarily used if the website doesn’t allow offensive language to be used in passwords.

source: http://www.makeuseof.com/tag/5-ways-generate-secure-passwords-linux/