Quote 3

What we have called matter is energy, whose vibration has been so lowered as to be perceptible to the senses. There is no matter.
–Albert Einstein

Clean URLs with Apache httpd

a la Caddy server

Caddy server let’s you easily define implicit extensions for your server URLs. Check ext directive in it’s documentation.

Get the same result in apache httpd using rewrite rules

Configuration snippet
RewriteEngine On
# Auto ext, clean URLs
# -----
# .html
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !.*\.html$
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ $1.html [NC,L]
# .php
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !.*\.php$
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [NC,L]

The story: If 1) the URI does not already end with the extension and 2) if it is not a folder with the same name and 3) if the file with the added extension actually exists, then it adds the extension

Later edit:  If the folder exists the rewriting is not done and therefore the index.html or index.php in the folder is served. If you want the file plus the added extention to have precedence over folder, comment out out the 2nd condition.

flag L|last stop processing rules after match. If you have other rules you need applied, remove it!

flag NC|nocase case-insensitive matching

Use the config snippet per VirtualHost. Or add it to your server global rewrite rules. Usually it’s the /etc/apache2/mods-enabled/rewrite.conf file. Don’t forget about RewriteOptions Inherit in your VirtualHost if you use the global configuration.

— tried and works with Apache 2.4

Byobu Tmux Screen

Shortcuts

Function keys work by default only in byobu.

Create a new window

c-a a or F2

Move to the previous window

c-a p or F3

Move to the next window

c-a n or F4

Detach from the session and logout

c-a d or F6

Enter scrollback/search mode

c-a [  or F7

Rename the current window

c-a A or F8

Tell byobu to not set the terminal window title

export BYOBU_NO_TITLE=1
You can set the title of your terminal window by running
echo -ne "\033]0;${HOSTNAME%%.*}\007"

This will set your terminal title to the hostname your are on (without domain part). Add this to your $PROMPT_COMMAND to set it automatically with every command you run.

Organize your Photos by Date Using Exiftool

Find all photos without date information

$ exiftool -filename -filemodifydate -createdate -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' .

Set last created and modified to a specific date

$ find . -name "*.jpg" | while read filename;
exiftool "-AllDates=1986:11:05 12:00:00" "$filename";
done

Copy of the originals will be created. Remove *.jpg_original if everything went fine or add -overwrite_original parameter.

Timeshift

by one year

$ exiftool "-AllDates+=1:0:0 00:00:00" .

Rename your files to contain the date and time

they will be suffixed with -N if they have the same date and time

$ exiftool '-FileName<DateTimeOriginal' -d "%Y%m%d_%H%M%S%%-c.%%e" *.jpg
$ exiftool '-FileName<DateTimeOriginal' -d "%Y-%m-%d %H.%M.%S%%-c.%%e" *.jpg

Copy your photos in a folder structure organised by datetime

exiftool '-Directory<CreateDate' -d ~/Dropbox/Photos/%y/%y%m -r .

Git Sheet

Release (aka get the last version without the .git folder)

git archive --remote gogs@rdd.ro:liv/dotFiles.git HEAD | tar xvf -
git archive --remote gogs@rdd.ro:liv/dotFiles.git HEAD sub-folder | tar xvf

Add remote origin and set upstream to and existing git repository

git remote add origin gogs@rdd.ro:liv/dotFiles.git
git push -u origin master # set the upstream branch to master

Change remote origin

Remove the current origin and add a new one as above

git remote remove origin

Delete remote tag

git push origin --delete refs/tags/TAG_NAME

Delete remote branch

git push origin --delete refs/heads/BRANCH_NAME

See commit log and changes before merging into working copy

 Fetch
git fetch origin
Check the log and/or the changes
git log -p master..origin/master
git log origin/master
Merge
git merge origin/master

Log Graph

$ git log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short

My .gitconfig

[user]
name = liv
email = liv@rdd.ro
[core]
 autocrlf = input
 safecrlf = true
 whitespace = trailing-space,space-before-tab
[alias]
 co = checkout
 ci = commit
 st = status --short --branch
 br = branch
 hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
 type = cat-file -t
 dump = cat-file -p
 info = remote show origin
 please = push --force-with-lease
[push]
 default = simple
[advice]
 statusHints = false