Skip to content

Instantly share code, notes, and snippets.

@haiyon
haiyon / host.conf
Last active November 29, 2017 09:10
nginx
server {
listen 80;
server_name domain.com www.domain.com;
access_log /dev/null;
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 444;
}
location ^~ /.well-known/acme-challenge/ {
#!/bin/sh
opkg update
for ipk in $(opkg list-upgradable | awk '$1!~/^kmod|^Multiple/{print $1}'); do
opkg upgrade $ipk
done
@haiyon
haiyon / process.json
Last active October 12, 2016 08:45
pm2 run config
{
"apps": [{
"name": "app-service",
"script": "server/index.js",
"watch": true,
"log_date_format": "YYYY-MM-DD HH:mm Z",
"instances": 2,
"ignoreWatch": ["[\\/\\\\]\\./", "node_modules"],
"merge_logs": true,
"exec_interpreter": "./node_modules/.bin/babel-node",
@haiyon
haiyon / code-push-publish.sh
Last active February 14, 2017 03:40
Code Push Publish Shell
#!/bin/bash
today=$(date +%Y%m%d%H%M%S)
log_file="./release/logs/release_${today}.log"
Publish(){
app_name=$1 platform=$2 varsion=$3
react-native bundle --platform ${platform} --entry-file index.${platform}.js --bundle-output ./release/${platform}/main.jsbundle --assets-dest ./release/${platform} --dev false
code-push release ${app_name} ./release/${platform}/main.jsbundle ${varsion}
}
@haiyon
haiyon / mdr.sh
Last active January 12, 2017 14:28
mongo dump/restore
# @A Shen
#!/bin/bash
## 基本配置
# 数据来源
base_host="host_url"
base_db="db_name"
# 导入目标
dev_host="host_url"
dev_db="db_name"
#!/bin/bash
SCRIPT_DIR="/root"
DATE_TIME=$(date +%Y%m%d%H%M)
TMP_FILE="$HOSTNAME-$DATE_TIME.tar.gz"
BACKUP_SRC="/etc/nginx /data/www /data/docker/gogs" #备份文件,多个用空格隔开
QINIU_BUCKET="buck_name"
echo "打包文件中..."
tar cfzP "$TMP_FILE" $BACKUP_SRC
echo "打包完成, 上传到七牛云存储..."
$SCRIPT_DIR/qshell rput "$QINIU_BUCKET" "backup/$TMP_FILE" $TMP_FILE true
@haiyon
haiyon / acme.sh
Last active December 20, 2024 06:21
#!/bin/bash
set -e
# Add acme user if not exists
if ! id "acme" &>/dev/null; then
echo "Creating acme user..."
sudo useradd -r -m -d /var/lib/acme -s /usr/sbin/nologin acme
sudo chmod 700 /var/lib/acme
else
echo "User acme already exists, skipping creation..."
// .stglobalignore
// Syncthing Ignore Patterns - https://docs.syncthing.net/users/ignoring.html#patterns:
// Useful .stignore Patterns - https://goo.gl/DVHI1h
// Usage: Add the line below to all .stignore files for each Syncthing node
// #include .stglobalignore
// Incomplete Downloads
// Firefox downloads
*.part