Xbindkey

安装

1
sudo apt install xbindkeys xautomation wish

配置

1
xbindkeys --defaults > $HOME/.xbindkeysrc

Media Btn

1
2
3
4
5
6
7
8
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.netease-cloud-music /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next"
b:8

"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.netease-cloud-music /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause"
b:2

"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.netease-cloud-music /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous"
b:9

容器网络Debug工具箱

Net Tools

查询服务内部TCP状态

1
PATTERN=redis sh -c "nsenter -t `docker ps  | grep $PATTERN | awk '{print $1}' | xargs  docker inspect -f '{{.State.Pid}}'` -n netstat -ntuo"

Mac下容器内部访问宿主机网络

Use your internal IP address or connect to the special DNS name host.docker.internal which will resolve to the internal IP address used by the host.

Read More

镜像站快速替换

alpine

1
sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories

Debian

1
2
sudo sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
sudo sed -i 's|security.debian.org/debian-security|mirrors.ustc.edu.cn/debian-security|g' /etc/apt/sources.list

Ubuntu

1
sudo sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list

CyclicBarrier 详解

A synchronization aid that allows a set of threads to all wait for each other to reach a common barrier point. CyclicBarriers are useful in programs involving a fixed sized party of threads that must occasionally wait for each other. The barrier is called cyclic because it can be re-used after the waiting threads are released.

如Docs中所言,一个同步的工具能够让所有的线程等到一个集中点再继续执行。

Overview

1
2
3
4
5
6
public interface Future<V> {
boolean cancel(boolean mayInterruptIfRunning);
boolean isCancelled();
boolean isDone();
V get() throws InterruptedException, ExecutionException;
V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException;

Read More