Friday, July 6, 2018

macOS: paste without style

Instead of using ⌘+V , you can press ⌥+⇧+⌘+V to paste text without any formatting.

Thursday, July 5, 2018

macOS: triple click to select path in Terminal

Source: Is there a UNIX-style triple click to select path in Terminal.app?
The shortcut for Terminal.app is ⌘+⇧+doubleclick.

macOS: install postgreSQL 9.4

brew install postgresql@9.4 --with-python
brew link postgresql@9.4 --force

macOS: install sshpass

brew install http://git.io/sshpass.rb

macOS: Fixing HOME and END keys

Source: Fixing HOME and END keys, and more, on macOS
mkdir -p $HOME/Library/KeyBindings
echo '{
/* Remap Home / End keys to be correct */
"\UF729" = "moveToBeginningOfLine:"; /* Home */
"\UF72B" = "moveToEndOfLine:"; /* End */
"$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + Home */
"$\UF72B" = "moveToEndOfLineAndModifySelection:"; /* Shift + End */
"^\UF729" = "moveToBeginningOfDocument:"; /* Ctrl + Home */
"^\UF72B" = "moveToEndOfDocument:"; /* Ctrl + End */
"$^\UF729" = "moveToBeginningOfDocumentAndModifySelection:"; /* Shift + Ctrl + Home */
"$^\UF72B" = "moveToEndOfDocumentAndModifySelection:"; /* Shift + Ctrl + End */
}' > $HOME/Library/KeyBindings/DefaultKeyBinding.dict

Wednesday, July 4, 2018

Virtualbox: Connect to the host machine from a VirtualBox guest OS

Source: Connect to the host machine from a VirtualBox guest OS
See "Another way to do this is to use a "Host" type of virtual network."

The simplest to always get the same IP address @home and @office for your VM is to use the Host-only adapter.

git: use p4merge on macOS

Source: Customizing Git, section External Merge and Diff Tools.

macOS: -bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory

Source: nixCraft
Option #1 : Terminal > Preferences > Profiles
However, this may cause some issues with e.g. PostgreSQL psql displaying unicode characters, e.g. <e2><94><8c><e2><94><80>.
So, if the issue is only caused by ssh, I prefer option #2:
sudo vi /etc/ssh/ssh_config
#       SendEnv LANG LC_*

macOS: size of email data

Spark Email
Outlook 2016
Mail

Monday, July 2, 2018

byobu: Function keys in Macos terminal

In order to have F2 or F8 work as expected for byobu in Macos terminal, you need to configure it as xterm-256 :
Terminal | Preferences

Wednesday, June 27, 2018

Wednesday, June 20, 2018

Git: The art of rebase

Source: Always Squash and Rebase your Git Commits
[Edit]: Squash the Last X Commits Using Git

Clojure: create a Clojure docker

Use case: I need to run some Clojure tests that use a library depending on glibc 2.14.
Unfortunately, I use CentOS 6.9 that relies on glibc 2.12, that cannot be updated.
Solution: Use a Docker file to run the Clojure tests.

Source: https://store.docker.com/images/clojure
docker pull clojure
  • Dockerfile
  • FROM clojure
    RUN mkdir -p /usr/src/app
    WORKDIR /usr/src/app
    COPY project.clj /usr/src/app/
    RUN lein deps
    COPY . /usr/src/app
    RUN lein uberjar
    CMD ["lein", "test"]
  • docker.build.sh
  • set -x
    cd ~/av-usage
    cp ~/tmp/clojure/docker/Dockerfile Dockerfile.test
    docker build -f Dockerfile.test -t av-usage-test .
    rm Dockerfile.test
  • docker.run.sh
  • set -x
    docker run -it --rm --name my-av-usage-test av-usage-test

Git: Reset local branch to remote HEAD

Source: Reset local repository branch to be just like remote repository HEAD
git fetch origin
git reset --hard origin/master

Thursday, June 14, 2018

yum: installed package

yum list installed | grep glibc

Saturday, April 21, 2018

Macos: Hide extra partitions in Clover

List partitions :
List UUID of partitions to hide :
Hide the UUID in Clover Configurator | Gui | Hide Volume :

Sunday, April 15, 2018

Macos: Where is my Firefox profile ?

  • Suppose you want to retrieve your Firefox profile and move it because it has initially been installed on another HDD.
  • Copy your profile directory from your old HDD, e.g. :
/Volumes/osx/Users/jerome/Library/Application\ Support/Firefox/Profiles/2ii3i4a1.default/
  • Into the new disk at :
/Users/jerome/Library/Application\ Support/Firefox/Profiles/
  • Copy the name of the default profile that has been created on the new disk
  • Remove this default profile 
  • Rename the old default profile like the new one just copied.

Macos: how to tab between buttons

Wednesday, April 11, 2018

Linux: Find Out What Process Are Using Swap Space

Source : Linux: Find Out What Process Are Using Swap Space
for file in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file; done | sort -k 2 -n -r | less