This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add following code at the end of ~/.bashrc | |
# Check if ~/.pid_ssh_agent exists. | |
if [ -f ~/.pid_ssh_agent ]; then | |
source ~/.pid_ssh_agent | |
# Check process of ssh-agent still exists. | |
TEST=$(ssh-add -l) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [[ -z "$2" ]]; then | |
echo './add-apache2-copyright.sh <path> <ext>'; | |
exit; | |
fi | |
for i in $(find $1 -type f -name "*.$2") | |
do | |
HAS_CR_COMMENT=$(cat $i | grep 'www.apache.org') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MQ_DOCKER_PORT=5672 | |
MQ_DOCKER_ADMIN_USER="user" | |
MQ_DOCKER_ADMIN_PASS="password" | |
MQ_DOCKER_ADMINCP_PORT=15672 | |
MQ_DOCKER_PATH=/var/lib/rabbitmq | |
MQ_DOCKER_NAME="RabbitMQ-Server" | |
MQ_DOCKER_MEMORY=256M | |
MQ_LOCAL_PATH=/docker/rabbitmq | |
MQ_LOCAL_HOST=0.0.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3" | |
services: | |
mysql.loc: | |
container_name: "mysql.loc" | |
image: "mysql:5.7" | |
deploy: | |
resources: | |
limits: | |
cpus: '0.50' | |
memory: 500M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A JS implementation of PBKDF2. | |
// For study only, don't use this. | |
// Use NodeJS native implementation `crypto.pbkdf2` instead. | |
const Crypto = require('node:crypto'); | |
function hmac(hmacAlgo, key, data) { | |
return Crypto.createHmac(hmacAlgo, key).update(data).digest(); | |
} | |
const BUF_INT32_BE = Buffer.alloc(4); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## File: /etc/init.d/frps | |
#!/bin/sh | |
# | |
# frps: FRP-Server Daemon | |
# | |
# description: FRP-Server Daemon | |
PID_FILE=/run/frps.pid | |
CONFIG_FILE=/etc/frps.ini | |
FRP_SERVER=/usr/local/frps/frps | |
start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
## See https://stackoverflow.com/a/48029079/6559859 | |
for k in $(docker ps --format='{{.ID}}') | |
do | |
echo "" > $(docker inspect --format='{{.LogPath}}' $k) | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as $crypto from 'crypto'; | |
const WEPAY_MCH_ID = 12345678; | |
const WEPAY_API_KEY = ''; | |
const NONCE_STR = $crypto.randomBytes(16).toString('hex'); | |
const REQ_SIGN = $crypto.createHash('md5') | |
.update(`mch_id=${WEPAY_MCH_ID}&nonce_str=${NONCE_STR}&sign_type=MD5&key=${WEPAY_API_KEY}`) | |
.digest('hex') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MONGO_DOCKER_MAX_MEMORY=512M | |
MONGO_DOCKER_PORT=27017 | |
MONGO_DOCKER_DATA_DIR=/data/db | |
MONGO_DOCKER_NAME=Mongo-Server | |
MONGO_LOCAL_PORT=27017 | |
MONGO_LOCAL_DATA_DIR=/docker/mongo/db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Redis configuration file is /docker/redis/redis_6379.conf:/data/redis_6379.conf | |
# Redis RDB file dir is /docker/redis/dump.rdb:/data/dump.rdb | |
REDIS_CONFIG_FILE=redis_6379.conf | |
DOCKER_REDIS_ROOT=/data | |
DOCKER_CONTAINER_NAME="Redis-Server" | |
DOCKER_MAX_MEMORY=256m | |
DOCKER_MAX_CPU=1 |
NewerOlder