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
function to32BitHex(v) { | |
if (typeof (v) !== 'number' || (Number.isInteger && !Number.isInteger(v))) { | |
throw new TypeError("Require a number as the argument."); | |
} | |
v = 0xFFFFFFFF & v; | |
if (v < 0) { | |
return (v >>> 0).toString(16); | |
} | |
else { | |
return v.toString(16); |
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
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "node", | |
"request": "attach", | |
"name": "[Remote-Debug-Sample] Auto-Attach", | |
"remoteRoot": "/home/admin/node-projects/remote-debug", | |
"protocol": "inspector", | |
"address": "localhost", |
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
/** | |
* Get the same day in neighboring month, e.g. | |
* | |
* Input: ("2018-10-31", 1) Output: 2018-11-30 | |
* | |
* Input: ("2018-10-30", 1) Output: 2018-11-30 | |
* | |
* Input: ("2018-01-31", 1) Output: 2018-02-28 | |
* | |
* Input: ("2020-01-31", 1) Output: 2020-02-29 |
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 |
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
export Ali_Key="<ACCESS_KEY>" | |
export Ali_Secret="<SECRET_KEY>" | |
THE_DOMAIN=litert.org | |
THE_CERT_OUTPUT_DIR=/etc/nginx/ssl.d | |
mkdir -p $THE_CERT_OUTPUT_DIR | |
acme.sh --issue \ | |
--dns dns_ali \ | |
-d "$THE_DOMAIN" \ |
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 | |
# Method 1, reference: https://stackoverflow.com/a/29497919 | |
git log --tags --simplify-by-decoration --pretty="format:%ci %d" | head -n 1 | grep -Po '(?<=tag: ).+?(?=,)' | |
# Method 2, reference: https://stackoverflow.com/questions/6269927/how-can-i-list-all-tags-in-my-git-repository-by-the-date-they-were-created#comment81585017_24830212 | |
git tag --sort=-creatordate | head -n 1 |
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
# 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
#!/bin/bash | |
# Usage | |
# | |
# We assume the link of remote repository is of SSH style like: | |
# | |
# <git-user>@<domain>:<scope>/<project-name>.git | |
# | |
# git-switch-remote-repo <remote-name> full <full-repo-link> | |
# git-switch-remote-repo <remote-name> domain <new-domain> |
OlderNewer