Skip to content

Instantly share code, notes, and snippets.

View RafaelPalomar's full-sized avatar

Rafael Palomar RafaelPalomar

  • The Intervention Centre. Oslo University Hospital
  • Oslo
View GitHub Profile
@RafaelPalomar
RafaelPalomar / emacs-notes.org
Last active May 14, 2019 18:25
Emacs configuration (adapted to gentoo) #gentoo #emacs #configuration

Notes on Emacs configuration (Gentoo)

For gist package to work

  • Install emacs v25, I could not find a good way to make v26 work
  • Add the following snippet to init.el file. This is a workaround for a known bug
    (advice-add 'gnutls-available-p :around #'ignore)
        
  • Build gnutsl with sslv3 support (flag)

For all-the-icons to work

  • After installation run the command (all-the-icons-install-font
@RafaelPalomar
RafaelPalomar / emacs-sudo-ssh-open-file.org
Last active May 6, 2019 14:27
How to open a remote file with emacs using ssh and sudo #emacs #ssh #sudo

Use emacs to open a file remotely with ssh as sudo

It is possible to chain different protocols to open a file remotely with sudo. Press C-x, C-f as usual and go to ssh:[user]@<host>|sudo:[user]@<host>:/<path>.

@RafaelPalomar
RafaelPalomar / dockerized-application-xorg-connection.org
Last active May 7, 2019 19:25
How to run a dockerized application which uses the host Xorg for graphics #docker #xorg

Connection to local Xorg from a dockerized application

  • One must deal with the security of Xorg for accepting connections. It should be better ways, but the best I found is xhost +, which disables the security.

Command for running the container

docker run -ti --rm \
       --net=host --device=/dev/dri -e DISPLAY=$DISPLAY \
       -v /tmp/.X11-unix:/tmp/.X11-unix \
       <docker image>      
@RafaelPalomar
RafaelPalomar / dockerized-nextcloud-client.org
Last active May 31, 2019 06:49
How to run a dockerized version of the nextcloud client #docker #nextcloud

Dockerized nextcloud-client

This explains how to setup nextcloud-client running in a docker container. The rationale behind this is that in Gentoo, the nextcloud client requires a version of SSL which casuses a lot of troubles (I eventually ended up with strong incompatibilities).

I prepared a simple docker image based on Ubuntu 18.04 to host the dockerized version of nextcloud client

@RafaelPalomar
RafaelPalomar / emacs-daemon-systemd.org
Last active March 30, 2023 05:27
How to start emacs-daemon in a systemd service #emacs #systemd

Load Emacs as a daemon with a Systemd user unit

This gist is based on Intelligent Rumblings. Running emacs as a daemon with Systemd

First, create a systemd unit file at ~/.config/systemd/user/emacs.service:

[Unit]
Description=Emacs text editor
Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/

[Service]
@RafaelPalomar
RafaelPalomar / docker-opengl-nvidia.org
Last active November 28, 2023 16:54
How to run an OpenGL dockerized application with Nvidia #nvidia #docker #opengl

Running OpenGL applications within Nvidia Containers

Preparing the container

This explains how to run an OpenGL applications within containers using Nvidia’s OpenGL.

I prepared a docker image based on Nvidia’s OpenGL container

FROM nvidia/opengl:1.0-glvnd-runtime
@RafaelPalomar
RafaelPalomar / org_source_block_header_arg_in_properties.org
Created May 31, 2019 17:54
How to set multiple org source blocks headers in a property #org-mode #emacs #source #blocks

Setting multiple org-mode source block arguments in :PROPERTIES:

As an example, the following source block will be executed in the /var directory independently of where the .org file is.

The keyis to add a property named header-args (C-c C-x p) and set the list of arguments to be included in the blocks (e.g., =:dir /var).

@RafaelPalomar
RafaelPalomar / docker-slicer-ubuntu.org
Last active September 12, 2019 09:44
Docker image for 3D Slicer 4.10.2 in Ubuntu #docker #3dslicer #ubuntu

Docker image for 3D Slicer 4.10.2 in Ubuntu 18.04

This document describes the environment needed for building 3DSlicer v4.10.2 in Ubuntu 18.04.

First we derive from the official Ubuntu 18.04 image.

@RafaelPalomar
RafaelPalomar / gentoo-uncomplicated-firewall.org
Last active June 20, 2019 10:49
Setting up uncomplicated firewall in Gentoo (example) #gentoo #firewall #example

Setting up uncomplicated firewall in Gentoo (Example)

This example considers the installation of “Uncomplicated Firewall” with the following rules:

  • Disallow incoming connections
  • Disallow outgoing connections
  • Exceptionally allowing inccoming connections for SSH
  • Exceptionally allowing outgoing connections for server update (Gentoo)
  • Exceptionally allowing outgoing connections for an external private docker registry
@RafaelPalomar
RafaelPalomar / dired_regexp_trailing_zeroes.org
Created August 28, 2019 11:01
Batch renaming with regular expressions and dired #emacs #dired #regexp #trailingzeroes

Dired + RegExp to add trailing zeroes to filenames

This recipe is used to rename files containing a sequence to their corresponding names with trailing zeroes. For the examples I had files like:

-rw-rw---- 1 aure aure   32244064 Nov 29  2016 segmentation-1.nii
-rw-rw---- 1 aure aure  135528800 Nov 29  2016 segmentation-2.nii
-rw-rw---- 1 aure aure  139985248 Nov 29  2016 segmentation-3.nii
-rw-rw---- 1 aure aure  440926560 Nov 29  2016 segmentation-4.nii