Skip to content

Instantly share code, notes, and snippets.

@seafooler
seafooler / manpath-wrong
Created December 19, 2017 12:52
Fix: "manpath: can't set the locale; make sure $LC_* and $LANG are correct"
## Problem
When login in, the shell prints:
```
manpath: can't set the locale; make sure $LC_* and $LANG are correct
```
## Solution
```
sudo locale-gen "en_US.UTF-8"
sudo dpkg-reconfigure locales
@seafooler
seafooler / docker-daemon-wrong
Created December 20, 2017 05:22
Fix: "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"
## Problem
```
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
```
## Reasons
There are several graphdrivers available and Docker daemon cannot decide which one to choose.
You can find the reported problems in `/var/log/upstart/docker.log`
## Solution
@seafooler
seafooler / ssh-docker
Created January 3, 2018 02:48
Specify the ip address of a Docker container && ssh it
# Create a specified network bridge
```
docker network create -o "com.docker.network.bridge.name"="docker1" --subnet 172.20.0.0/24 docker1
```
# Run a container
```
docker run -d --rm --ip 172.20.0.50 --net docker1 --name friendly-container rastasheep/ubuntu-sshd:14.04
```
@seafooler
seafooler / create-newuser
Last active January 3, 2018 03:02
Create a new user and related home directory
#Create a new user and related home directory
```
sudo useradd -d /home/$username -m $username
```
#Set the passwd
```
sudo passwd $username
```
@seafooler
seafooler / README.md
Last active January 6, 2018 05:36
Aliyun apt sources.list

Use the lines below to replace /etc/apt/source.list

@seafooler
seafooler / docker-commit-command
Last active January 5, 2018 06:51
Docker commit command
Refer to "https://yeasy.gitbooks.io/docker_practice/content/image/commit.html"
```
docker commit \
--author "Tao Wang <[email protected]>" \
--message "修改了默认网页" \
webserver \
nginx:v2
```
@seafooler
seafooler / fix-chrome-ubuntu14.04
Created January 5, 2018 06:50
Chrome on Ubuntu14.04 cannot launch correctly
# Error
NSS_VersionCheck("3.26") failed. NSS >= 3.26 is required
# Solution
```
sudo apt-get install libnss3
```
@seafooler
seafooler / README.md
Last active January 6, 2018 05:10
terminator configuration file
@seafooler
seafooler / mount-sshfs
Created January 5, 2018 09:48
Command to mount a sshfs
sshfs -p 22 -o auto_cache,reconnect,default_permissions seafooler@cent-dock-01:/home/seafooler /home/seafooler/mnt-cent-dock-01
@seafooler
seafooler / pac-ctrl-st3.py
Last active January 6, 2018 03:07
Python code of package control for Sublime Text 3
import urllib.request,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee' + 'ebe013ee18cced0ef93d5f746d80ef60'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)