All posts by Saïd

Software developer.

GDAL: How to install it on MAC

  • Download GDAL package from the website: http://www.kyngchaos.com/software/frameworks/ and run it.
  • Export PATH
    echo 'export PATH=$PATH:/Library/Frameworks/GDAL.framework/Programs' >> ~/.zshrc
    source ~/.zshrc
  • Check the configuration
    gdal-config --version 2.3.3
  • Install python library
    pip install gdal==2.3.3 (from the command above)
  • I have tried:

    pip install gdal

    but got so many errors about clang or gcc … because headers were not the same.

Python: make wheels

Here a simple example to make a whell

First, install wheel package:

nickyvm$: pip install wheel

Then give the package you need offline and where to store it:

nickyvm$: pip wheel --wheel-dir=my_wheeldirectory psycopg2

Finally, to install it from offline:

pip install --use-wheel --user --upgrade --no-index --find-links=path/to/my_wheels psycopg2

GIT: revert commit

# Reset the index and working tree to the desired tree
# Ensure you have no uncommitted changes that you want to keep
$ git reset --hard 56e05fced
 
# Move the branch pointer back to the previous HEAD
$ git reset --soft HEAD@{1}
 
$ git commit -m "Revert to 56e05fced"
 
# https://stackoverflow.com/questions/1895059/revert-to-a-commit-by-a-sha-hash-in-git

How to use Tmux with iTerm

On centos 6, the tmux version is too old to be used with iTerm integration available on OSX. Either, you run centos7 and use yum, or you download a new version of Tmux from the official web site and compile it:

https://gist.github.com/pokev25/4b9516d32f4021d945a140df09bf1fde

On the server, create a new detached session named nickyvm-tmux for example:

nickyvm$: tmux new -s nickyvm-tmux -d

Afterwards, on osx make an alias that matches the configution below :

alias stmux_vm="ssh nickyvm -t 'tmux -CC attach -t nickyvm-tmux'"

My tmux configuration file:

set-option -g allow-rename off
set-option -g set-titles on
set-option -g set-titles-string '#T'

https://gitlab.com/gnachman/iterm2/wikis/tmux-Integration-Best-Practices

Source again your profile, open iTerm and call the alias. Enjoy

http://hyperpolyglot.org/multiplexers

How to use 7z

Select folders you would backup

7z a -p -mhe=on stuff.7z MyStuff
   ^  ^     ^      ^        ^
   |  |     |      |        `--- Files/directories to compress & encrypt.
   |  |     |      `--- Output filename
   |  |      `--- Encrypt filenames
   |  `---- Use a password
   `---- Add files to archive

Once done, put the archive in an usb hard disk somewhere else than your home or in the cloud (for archivage).