centurion:~ jerome$ log show --predicate 'eventMessage contains "Previous shutdown cause"' --last 24h Filtering the log data using "eventMessage CONTAINS "Previous shutdown cause"" Skipping info and debug messages, pass --info and/or --debug to include. Timestamp Thread Type Activity PID TTL 2018-07-14 11:14:28.111106+0200 0xe5 Default 0x0 0 0 kernel: (AppleSMC) Previous shutdown cause: 5 2018-07-14 11:32:41.196172+0200 0xe3 Default 0x0 0 0 kernel: (AppleSMC) Previous shutdown cause: 5 -------------------------------------------------------------------------------------------------------------------- Log - Default: 2, Info: 0, Debug: 0, Error: 0, Fault: 0 Activity - Create: 0, Transition: 0, Actions: 0
Saturday, July 14, 2018
macOS: know the previous shutdowns cause
Tuesday, July 10, 2018
macOS: release C-left, C-right, C-up, C-top for Emacs
On Emacs, I use key bindings for ^↑ (C-up), ^↓ (C-down), ^← (C-left) and ^→ (C-right), but macOS by default maps them to Mission Control. In order to replace ^ with ⌘ for Mission Control shortcuts, use System Preferences > Keyboard > Shortcuts like in
macOS: install Apache2::Request mod_perl module
Sources:
For this, install httpd from homebrew.
So, install it from the Apple Store.
Then, Apache2::Request install will try to have access to multiple Xcode directories that do not exist.
So, create symbolic links and missing directory.
Then update Apache configuration.
- Compile mod_perl for Apache 2.4 on Mac OS X 10.10 Yosemite
- Installing RApache on Mac OS X Snow Leopard
- Apache libapreq2
cpan Apache2::Request
First, we will need apxs (Apache Extension tool).For this, install httpd from homebrew.
brew install httpd
Then, we will need Xcode.So, install it from the Apple Store.
Then, Apache2::Request install will try to have access to multiple Xcode directories that do not exist.
So, create symbolic links and missing directory.
sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/ /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.13.xctoolchain sudo mkdir -p /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.13.xctoolchain/usr/local/bin/ sudo ln -s /usr/local/bin/apxs /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.13.xctoolchain/usr/local/bin/apsx sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.Internal.sdkThen install libapreq2 library.
- Download libapreq2-2.13.
- Compile libapreq2 sources.
tar xvfz libapreq2-2.13.tar.gz
cd libapreq2-2.13
./configure
make
make install
Then install mod_perl 2.
svn checkout https://svn.apache.org/repos/asf/perl/modperl/trunk/ mod_perl-2.0
cd mod_perl-2.0
perl Makefile.PL MP_CCOPTS=-std=gnu89
make
make install
NB: mod_perl.so and mod_apreq2.so will be installed in /usr/local/lib/httpd/modules.Then update Apache configuration.
vi /usr/local/etc/httpd/httpd.conf
LoadModule perl_module lib/httpd/modules/mod_perl.so
LoadModule apreq_module lib/httpd/modules/mod_apreq2.so
...
ServerName jeroboam:8080
...
PerlSwitches -I /Users/jerome/perl5/lib/perl5
PerlModule Apache::DBI
PerlModule ModPerl::Registry
PerlRequire /Users/jerome/src/connectmv/perl/lib/startup.pl
<Location /hlr_vas/>
SetHandler perl-script
PerlResponseHandler MBQT::mod_perl::HlrVas
</Location>
# PerlSetEnv DBG_FLG 1
Apache restart
/usr/local/bin/apachectl restart
Friday, July 6, 2018
macOS: iconify / deiconify shortcuts
- Iconify: ⌘+M
- Deiconify: ⌘+TAB, then select application, then press ⌥, then, release ⌘
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.
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
Labels:
macos,
postgresql
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.
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.
Labels:
virtualbox
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:
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_*
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
Terminal | Preferences
Wednesday, June 27, 2018
Wednesday, June 20, 2018
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.build.sh
docker.run.sh
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"]
set -x cd ~/av-usage cp ~/tmp/clojure/docker/Dockerfile Dockerfile.test docker build -f Dockerfile.test -t av-usage-test . rm Dockerfile.test
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
Monday, June 11, 2018
Subscribe to:
Posts (Atom)


