Skip to content

Instantly share code, notes, and snippets.

View webee's full-sized avatar
🎯
Focusing

webee.yw webee

🎯
Focusing
View GitHub Profile
#!/bin/bash
# /etc/nginx/ssl/<site>/
site=$1
# DNS:www.abc.xyz,DNS:xyz.abc.xyz
domains=$2
OPENSSL_CNF=/etc/pki/tls/openssl.cnf
ssl_dir=/etc/nginx/ssl
mkdir -p ${ssl_dir}
#!/bin/bash
###########
# add crontab
# 0 0 1 * * /root/src/renew_ssl_cert.sh <site> 2>>/var/log/acme_tiny.log
###########
site=$1
domains=$2
if [ -n "${domains}" ]; then
# init
@webee
webee / supervisord.service
Last active September 26, 2016 07:47 — forked from tonyseek/supervisord.service
Running supervisord with systemd.
[Unit]
Description=supervisord - Supervisor process control system for UNIX
Documentation=http://supervisord.org
After=network.target
[Service]
Type=forking
ExecStart=/usr/bin/supervisord -c /etc/supervisord.conf
ExecReload=/usr/bin/supervisorctl reload
ExecStop=/usr/bin/supervisorctl shutdown
@webee
webee / install_xapian_inside_virtualenv_osx.sh
Created October 30, 2015 06:16 — forked from carymrobbins/install_xapian_inside_virtualenv_osx.sh
Install xapian in a virtualenv on Mac OS X using Homebrew.
#/bin/bash
set -e
if [ -z "$(which brew)" ]; then
echo "This script requires Homebrew."
exit
fi
if [ -z "$VIRTUAL_ENV" ]; then
######################
# Options
######################
NULL=
REVEAL_ARCHIVE_IN_FINDER=false
FRAMEWORK_NAME="${PROJECT_NAME}"
SIMULATOR_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${FRAMEWORK_NAME}.framework"
@webee
webee / SwfitObjectAssociateUtil
Last active September 17, 2015 10:17
associate object to class in swift.
// refer to: http://rosettacode.org/wiki/Add_a_variable_to_a_class_instance_at_runtime#Swift
// this is stupid, just inherit the target class.
import Foundation
class ObjectAssociateUtil {
static var objKeys = [String:UnsafePointer<()>]()
class func getAssociateObject<T:AnyObject, D>(target:T, by_key key:String) -> D? {
let objKeyName = "\(NSStringFromClass(target.dynamicType)).\(key)"
if let objKey = objKeys[objKeyName] {
@webee
webee / util.dateDiff.sh
Created September 11, 2014 07:18
linux date diff.
#/bin/env sh
date2stamp () {
date --utc --date "$1" +%s
}
stamp2date (){
date --utc --date "1970-01-01 $1 sec" "+%Y-%m-%d %T"
}
dateDiff (){
#!/bin/sh
#
# /etc/rc.d/init.d/supervisord
#
# Supervisor is a client/server system that
# allows its users to monitor and control a
# number of processes on UNIX-like operating
# systems.
#
# chkconfig: - 64 36
@webee
webee / python_logging
Created May 28, 2014 03:27
python logging demo.
import logging
def get_logger():
level = logging.DEBUG
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(module)s[%(lineno)d] - %(funcName)s - %(message)s')
@webee
webee / generate_project_from_test.sh
Last active August 29, 2015 13:59
generate a maven jar project from test-maven-project.
#!/bin/bash
name=$1
username=webee
template=test-maven-project
function LOG_INFO() {
local msg=$1
echo "[$(date +'%Y-%m-%d %H:%M:%S.%N')][INFO] ${msg}"