Category Archives: General

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).

How to install/configure/backups Postgresql on debian

NOTE: This page is intented to be used to develop features to postgresql. Do not use this for production!

https://www.postgresql.org/docs/current/installation.html

https://mindchasers.com/dev/postgres

some tools to get install before

$ apt-get install zsh tree git curl wget emacs libreadline6-dev systemtap-sdt-dev zlib1g-dev libssl-dev libpam0g-dev python-dev build-essential llvm-3.9 llvm-3.9-dev clang-3.9 clang-3.9-dev bison flex libreadline-dev libreadline

to enable TAP tests:

$ perl -MCPAN -e shell
install CPAN
reload CPAN
install TAP::Parser::SourceHandler::pgTAP
install IPC::Run

Then:

$ cd postgresql
$ mkdir builds && cd $_
../configure --enable-debug --enable-depend --enable-tap-tests --enable-cassert CFLAGS="-ggdb -Og -g3 -fno-omit-frame-pointer"
$ make
$ make check
# needs root access below (go to the postgresql directory)
$ su -
$ make install
$ /sbin/ldconfig /usr/local/pgsql/lib
$ adduser --system --home /usr/local/pgsql/data --shell /bin/bash --group postgres
$ passwd postgres
# logout from root access
$ su - postgres
$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data --pwprompt
$ echo 'PATH=/usr/local/pgsql/bin:$PATH' >> ~/.zshrc
$ echo 'export PGDATA=/usr/local/pgsql/data' >> ~/.zshrc