Skip to content

Instantly share code, notes, and snippets.

View demon386's full-sized avatar

M. Tong demon386

View GitHub Profile
@demon386
demon386 / 0_reuse_code.js
Last active August 29, 2015 14:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@demon386
demon386 / TrueColour.md
Created January 31, 2016 01:33 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals

Colours in terminal

It's a common confusion about terminal colours... Actually we have this:

  • plain ascii
  • ansi escape codes (16 colour codes with bold/italic and background)
  • 256 colour palette (216 colours + 16 ansi + 24 gray) (colors are 24bit)
  • 24bit true colour ("888" colours (aka 16 milion))
printf "\x1b[${bg};2;${red};${green};${blue}m\n"
@demon386
demon386 / docker_env.org
Last active May 26, 2017 07:37
进阶:用 Docker 打造自己的开发环境

进阶:用 Docker 打造自己的开发环境

基本技巧

在预备课程当中,我们已经初步介绍过如何使用 Docker 启动 Tensorflow 环境,并把 Docker 内部的 jupyter notebook 端口暴露给本机。其中介绍的主要命令包括

docker run -it -p 8888:8888 tensorflow/tensorflow
用于以某个 image 为模板,启动一个 container (注意区分 image 和 container 的概念)
docker ps, docker ps -a
分别用于查看正在运行的 container,以及所有的 container(包括已经停止的)
docker start -i container_id
其中 container_id 是通过 docker ps -a 命令看到的,用于启动一个已经停止的 container
docker stop container_id
停止一个正在运行的 container

大家在使用 docker 的时候,可以把 image 理解成一张『操作系统』的光盘,container 就是一台用这张光盘装好系统的『虚拟计算机』。

@demon386
demon386 / tmux_build_from_source_CentOS.sh
Created January 5, 2018 03:37 — forked from P7h/tmux__CentOS__build_from_source.sh
tmux 2.0 and tmux 2.3 installation steps for Ubuntu. Or build from tmux source v2.5 for Ubuntu and CentOS.
# Steps to build and install tmux from source.
# Takes < 25 seconds on EC2 env [even on a low-end config instance].
VERSION=2.5
sudo yum -y remove tmux
sudo yum -y install wget tar libevent-devel ncurses-devel
wget https://github.com/tmux/tmux/releases/download/${VERSION}/tmux-${VERSION}.tar.gz
tar xzf tmux-${VERSION}.tar.gz
rm -f tmux-${VERSION}.tar.gz
cd tmux-${VERSION}