Skip to content

Instantly share code, notes, and snippets.

Docker Cheat Sheet

Why

Why Should I Care (For Developers)

"Docker interests me because it allows simple environment isolation and repeatability. I can create a run-time environment once, package it up, then run it again on any other machine. Furthermore, everything that runs in that environment is isolated from the underlying host (much like a virtual machine). And best of all, everything is fast and simple."

TL;DR, I just want a dev environment

@wangyingang
wangyingang / some_useful_command.md
Last active August 29, 2015 13:57
Some userful shell commands

Command and arguments reuse

1.^r in bash begins a reverse-search-history with command completion

Press ctrl+r in a bash shell and type a few letters of a previous command

I can't imagine how much typing this has saved me.

2.history and !number

@wangyingang
wangyingang / clean_old_kernel.md
Last active August 29, 2015 13:58
Ubuntu cleanup. Remove All Unused Linux Kernel Headers, Images and Modules

Remove All Unused Linux Kernel Headers, Images and Modules

list all installed kernels

dpkg --list | grep linux-image

clean up

dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge

if you’ve upgraded your system, or had an update with a new kernel, please reboot your machine before running above the command

@wangyingang
wangyingang / install_pandoc_on_mac.sh
Last active August 29, 2015 13:58 — forked from schmurfy/gist:3199254
Install pandoc on Mac OS
# Install MacTex: http://mirror.ctan.org/systems/mac/mactex/mactex-basic.pkg
$ sudo chown -R `whoami` /usr/local/texlive
$ tlmgr update --self
$ tlmgr install ucs
$ tlmgr install etoolbox
# Install pandoc view homebrew
$ brew install haskell-platform
$ cabal install pandoc

#SSH Login without password

  • Create public and private keys using ssh-keygen on local-host
    $ ssh-keygen
    

or

# Creates a new ssh key, using the provided email as a label
$ ssh-keygen -t rsa -C "your_email@example.com"
@wangyingang
wangyingang / force_change_password.md
Last active August 29, 2015 13:59
Force the user to change their password at first login

#Force the user to change their password at first login You can just expire that password. After creating a new user foo, just type:

$ sudo chage -d 0 foo

And he will be forced to change it after first logon.

@wangyingang
wangyingang / tmux.md
Last active August 29, 2015 14:22 — forked from andreyvit/tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$
// Match
2009-12T12:34
2009
2009-05-19
2009-05-19
20090519
2009123