Skip to content

Instantly share code, notes, and snippets.

@javasboy
javasboy / autobackup.sh
Created April 16, 2023 03:18 — forked from horizon86/autobackup.sh
Minecraft auto backup 下面是回档脚本,注意更改为你自己的存档文件夹
#!/bin/bash
set -euo pipefail
# tmux 会话名字
sessionName=mc
# 服务器关闭警告信息
stopDelay=10
stopWarn=服务器将在${stopDelay}秒后关闭进行备份
# 存档位置
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 5.14.2-gentoo Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="gcc (Gentoo 11.2.0 p1) 11.2.0"
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=110200
CONFIG_CLANG_VERSION=0
CONFIG_AS_IS_GNU=y
CONFIG_AS_VERSION=23700
@javasboy
javasboy / etcd_cluster.sh
Created July 15, 2021 03:53 — forked from jolestar/etcd_cluster.sh
Run etcd cluster by docker with custom network
docker network create etcd --subnet 172.19.0.0/16
docker run -d --name etcd0 --network etcd --ip 172.19.1.10 quay.io/coreos/etcd etcd \
-name etcd0 \
-advertise-client-urls http://172.19.1.10:2379,http://172.19.1.10:4001 \
-listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \
-initial-advertise-peer-urls http://172.19.1.10:2380 \
-listen-peer-urls http://0.0.0.0:2380 \
-initial-cluster-token etcd-cluster-1 \
-initial-cluster etcd0=http://172.19.1.10:2380,etcd1=http://172.19.1.11:2380,etcd2=http://172.19.1.12:2380 \
@javasboy
javasboy / gist:1878251ba39d9dee17ddb61ff80a2c8f
Created October 18, 2018 01:24
MySQL5.6 Replicationの設定

Replication

  • mysql 5.6
  • Mater IP Address = 192.168.1.1
  • Slave IP Address = 192.168.1.2

Master に repl ユーザーを作成する

以下の例では、repl ユーザーが192.168.1.2 からレプリケーション用の接続をできるようにしている。 レプリケーションなので、ON *.* で全データベース、全テーブルに対して許可している。

@javasboy
javasboy / ovpn-writer.sh
Created April 13, 2016 06:59 — forked from renatolfc/ovpn-writer.sh
Script to generate an OpenVPN client configuration file in the unified format
#!/bin/sh
##
## Usage: ./ovpn-writer.sh SERVER CA_CERT CLIENT_CERT CLIENT_KEY SHARED_SECRET > client.ovpn
##
server=${1?"The server address is required"}
cacert=${2?"The path to the ca certificate file is required"}
client_cert=${3?"The path to the client certificate file is required"}
client_key=${4?"The path to the client private key file is required"}
@javasboy
javasboy / android-client.ovpn
Created April 13, 2016 06:38 — forked from renatolfc/android-client.ovpn
A sample OpenVPN client configuration file in the unified format
client
dev tun
remote example.com
resolv-retry infinite
nobind
persist-key
persist-tun
ca [inline]
cert [inline]
key [inline]
@javasboy
javasboy / nginx.conf
Last active August 29, 2015 14:22 — forked from plentz/nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048

平台:DigitalOcean VPS ubuntu14.04 x64, strongswan5.2.2 运行以下命令请使用root权限

一:安装strongswan

由于ubuntu软件仓库中strongswan版本较低,因此从官网源码编译安装

apt-get install build-essential     #编译环境
aptitude install libgmp10 libgmp3-dev libssl-dev pkg-config libpcsclite-dev libpam0g-dev     #编译所需要的软件
@javasboy
javasboy / db.py
Last active August 29, 2015 14:07
#!/usr/ali/bin/python
# coding=utf-8
'''Implements a simple database interface
Example 0: Create connection:
# Set auto commit to false
db = DB(False, host = 'x', user = 'x', passwd = 'x', db = 'x')