Skip to content

Instantly share code, notes, and snippets.

@rlan
rlan / ubuntu_16.04_lts_to_20.04_lts.md
Last active May 12, 2022 13:40
Upgrading Ubuntu 16.04 LTS to 20.04 LTS

Summary: Need to upgrade to 18.04 first, then to 20.04.

Launch tmux before ssh into the vm, in case local network or vpn has issue, the vm continues to run your commands.

tmux new -s vm
ssh username@vm
@rlan
rlan / minerl_docker.md
Last active July 26, 2019 07:14
Docker for MineRL competition

What

Procedure for obtaining a docker environment for MineRL competition. Also included is a dummy agent.

Procedure

  1. Download docker image
docker pull wqael/mldock:minerl-pytorch1.1-py3-cuda10
@rlan
rlan / sshtun
Last active February 14, 2019 00:29
Port forwarding through a gateway server using SSH tunneling
#!/bin/bash -x
#
# Usage:
# sshtun gpu01
# sshtun gpu02 -t docker run -it --rm -p 48888:8888 -p 46006:6006 tensorflow/tensorflow:1.12.0-py3
#
PORT1=6006
PORT2=8888
FORWARD1=46006
@rlan
rlan / gui_docker.sh
Last active February 13, 2019 23:53
Run GUI applications from Docker
#!/bin/bash
#
# Usage ./gui_docker osrf/ros:kinetic-desktop-full
#
# Host-side pre-requisite:
# Linux: a desktop environment, e.g., GNOME
# MacOS: XQuartz (https://www.xqartz.org/)
# Windows: Xming (http://www.straightrunning.com/XmingNotes/)
#
xhost +local:root
@rlan
rlan / pip_force_reinstall.sh
Created January 23, 2019 23:59
force reinstall of pip
#!/bin/sh
#Force a reinstall of pip:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py --force-reinstall
# Verify install:
pip3 -V
@rlan
rlan / touch_all.sh
Last active January 24, 2019 00:02
Touch all files and directories recursively
#!/bin/sh
find . -exec touch {} \;
@rlan
rlan / ffmpeg_video_jpg.md
Last active January 10, 2026 14:51
Convert video to jpg and back using ffmpeg

Video and JPG conversion using FFMPEG

Grab one frame from video

#!/bin/sh -x
# $1 - input video file, e.g. video.mp4
# $2 - timestamp, e.g. 00:33
# $3 - output image file, e.g. output.jpg
ffmpeg -ss $2 -i $1 -vframes 1 -q:v 2 $3
@rlan
rlan / 20-info-motd
Created December 19, 2018 06:12
Ubuntu system info motd
#!/bin/sh
upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)"
secs=$((${upSeconds}%60))
mins=$((${upSeconds}/60%60))
hours=$((${upSeconds}/3600%24))
days=$((${upSeconds}/86400))
UPTIME=`printf "%d days, %02dh%02dm%02ds" "$days" "$hours" "$mins" "$secs"`
# get the load averages
@rlan
rlan / openai_venv.sh
Last active October 25, 2018 07:20
Install an OpenAI virtual environment (python 3)
#!/bin/sh
# Install an OpenAI virtual environment (python 3)
if [[ $# -eq 0 ]] ; then
echo "No arguments supplied! Please give a folder name"
exit 0
fi
python3 -m venv $1
source $1/bin/activate
@rlan
rlan / h264_nvenc.txt
Last active October 3, 2018 08:23
ffmpeg -h encoder=h264_nvenc
ffmpeg version 3.4.4-1~16.04.york0 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
configuration: --prefix=/usr --extra-version='1~16.04.york0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lib