Skip to content

Instantly share code, notes, and snippets.

View NikoWoot's full-sized avatar

Nicolas GAUTIER NikoWoot

View GitHub Profile
@NikoWoot
NikoWoot / run.sh
Created January 14, 2021 16:38
Create custom file descriptor
mkfifo /tmp/stdout /tmp/stderr
chmod 0666 /tmp/stdout /tmp/stderr
# Have the main Docker process tail the files to produce stdout and stderr
# for the main process that Docker will actually show in docker logs.
tail -f /tmp/stdout &
tail -f /tmp/stderr >&2 &
@NikoWoot
NikoWoot / install.sh
Created September 19, 2020 12:59
Resolve NPM and NodejSpermissions on WSL
mkdir ~/.npm
npm config set prefix ~/.npm
nano ~/.bashrc
export PATH="$PATH:$HOME/.npm/bin"
source ~/.bashrc
@NikoWoot
NikoWoot / bash-overssh
Created April 30, 2015 07:33
Bash over SSH
ssh root@MachineB 'bash -s' < local_script.sh
#!/bin/bash
EXPECTED_NUM_ARGS=1;
if [ "$#" -ne $EXPECTED_NUM_ARGS ]; then
# user didn't specify which container ID, assume the latest one
CONTAINER_ID=`/usr/bin/docker ps -q --no-trunc | /bin/sed -n 1p`
/usr/bin/docker exec -it $CONTAINER_ID bash
else
# enter the container the user specified
@NikoWoot
NikoWoot / Fig-Patch
Created December 31, 2014 11:19
Fig UnicodeDecodeError: 'ascii'
- If you have an special character (accent ?) in your path, Fig crash with "fig UnicodeDecodeError: 'ascii'"
@NikoWoot
NikoWoot / Steam-docker
Created December 21, 2014 22:04
Steam in docker
docker run --name=steam \
-v /tmp/.X11-unix:/tmp/.X11-unix -v /dev/shm:/dev/shm \
-v /run/user/${UID}/pulse:/run/user/${UID}/pulse \
-v /etc/machine-id:/etc/machine-id \
-v ${HOME}/Downloads:/tmp/Downloads \
-e DISPLAY=${DISPLAY} tianon/steam
@NikoWoot
NikoWoot / reduce-size.dockerimage
Created December 19, 2014 08:37
Reduce size of Docker image
=================================================
After software installation
=================================================
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
=================================================
Docker on build process, include all files on directory build (include .git with old build)
Solution for reduce size of docker image (but for reuse is not good solution)
=================================================
@NikoWoot
NikoWoot / docker-launchxsession
Last active August 29, 2015 14:11
Launch docker on host xsession
xhost +
docker run -Pti -e DISPLAY=$DISPLAY.0 -v /tmp/.X11-unix:/tmp/.X11-unix --net=host --name androidstudio nikowoot/android-studio
docker run -Pti -e DISPLAY=$DISPLAY.0 -v /tmp/.X11-unix:/tmp/.X11-unix --net=host --name phpstorm nikowoot/phpstorm
@NikoWoot
NikoWoot / Vbox-launchvty
Created December 16, 2014 10:01
Launch virtualbox in other graphical terminal (vty)
#!/bin/bash
# FIXME : Lancement via la commande sudo, lance virtualbox en tant que Root (donc ne pas marche pas)
# FIXME : sudo X, bug parfois et plante le terminal (fonctionne avec un sudo avant)
sudo X :3 -ac -terminate & # Lance sur un nouveau serveur X affichage 3
sleep 2 # Attend 2 secondes que le serveur soit prêt
DISPLAY=:3 virtualbox --startvm $1 --fullscreen # Lance l'application dans une autre Xsession