Skip to content

Instantly share code, notes, and snippets.

@wpc009
wpc009 / run.tpl
Created November 3, 2022 07:09 — forked from efrecon/run.tpl
`docker inspect` template to regenerate the `docker run` command that created a container
docker run \
--name {{printf "%q" .Name}} \
{{- with .HostConfig}}
{{- if .Privileged}}
--privileged \
{{- end}}
{{- if .AutoRemove}}
--rm \
{{- end}}
{{- if .Runtime}}
@wpc009
wpc009 / user-data.yaml
Last active February 18, 2019 08:23
aliyun vpn gateway cloud-init user-data
#cloud-config
write_files:
- content: |
#!/bin/bash
META_URL=http://100.100.100.200/2016-01-01/meta-data
VPC_CIDR_BLOCK=$(curl $META_URL/vpc-cidr-block)
MASK=$(echo ${VPC_CIDR_BLOCK} | sed -E 's%([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/([0-9]+)%\5%')
if [ $MASK == '8' ];then
PREFIX=$(echo ${VPC_CIDR_BLOCK} | sed -E 's%([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/([0-9]+)%\1.253.253%')
  • How to Create ExecutorService
ExecutorService es = new ForkJoinPool(2, new ForkJoinPool.ForkJoinWorkerThreadFactory() {
        @Override
        public ForkJoinWorkerThread newThread(ForkJoinPool pool) {
            ForkJoinWorkerThread thread = new ForkJoinWorkerThread(pool);
            return thread;
        }
    }, new Thread.UncaughtExceptionHandler() {
 @Override
@wpc009
wpc009 / README.md
Last active February 1, 2016 07:13
Suspects finding scripts for clmystery
@wpc009
wpc009 / start-stop-daemon-template
Last active June 14, 2016 09:17 — forked from bcap/start-stop-daemon-template
Template file for creating linux services out of executables using the start-stop-daemon
#!/bin/bash
### BEGIN INIT INFO
# Provides: <service name>
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: <service description>
### END INIT INFO