Skip to content

Instantly share code, notes, and snippets.

View sundy-li's full-sized avatar
🏠
Working from home

sundyli sundy-li

🏠
Working from home
View GitHub Profile
#!/bin/bash
# This script run at 00:00
# The data logs path
#日志存放
logs_path="/data/logs/nginx/"
#日志备份
backup_path="/data/backup/logs/nginx/"
#年份
year=$(date -d "yesterday" +"%Y")
@sundy-li
sundy-li / install_jenkins_plugin.sh
Created September 19, 2016 06:34 — forked from micw/install_jenkins_plugin.sh
Script to install one or more jenkins plugins including dependencies while jenkins is offline
#!/bin/bash
set -e
if [ $# -eq 0 ]; then
echo "USAGE: $0 plugin1 plugin2 ..."
exit 1
fi
plugin_dir=/var/lib/jenkins/plugins
@sundy-li
sundy-li / gist:fecf6a3c93fcf9ae7530f77d7f92602c
Created November 9, 2016 03:53 — forked from eduardocardoso/gist:82a629882ddb02ab3677
Script to delete exited containers and untagged/unused images from docker
#!/bin/bash
set -o errexit
echo "Removing exited docker containers..."
docker ps -a -f status=exited -q | xargs -r docker rm -v
echo "Removing dangling images..."
docker images --no-trunc -q -f dangling=true | xargs -r docker rmi
@sundy-li
sundy-li / sendmail_setup.md
Created February 24, 2017 15:42 — forked from kany/sendmail_setup.md
Setup SENDMAIL on Mac OSX Yosemite
@sundy-li
sundy-li / special_json.go
Last active March 23, 2017 13:26
json特殊字符串
Json中含有 特殊字符
String values encode as JSON strings coerced to valid UTF-8, replacing invalid bytes with the Unicode replacement rune. The angle brackets "<" and ">" are escaped to "\u003c" and "\u003e" to keep some browsers from misinterpreting JSON output as HTML. Ampersand "&" is also escaped to "\u0026" for the same reason. This escaping can be disabled using an Encoder with DisableHTMLEscaping.
方法1:
data := json.RawMessage(`"key": "http://www.baidu.com?a=c&b=d&e=d"`)
bytes, err := data.MarshalJSON()
@sundy-li
sundy-li / regexp_namedgroup.go
Created March 24, 2017 02:43
regexp_namedgroup.go
package main
import (
"fmt"
"regexp"
)
var myExp = regexp.MustCompile(`(?P<first>\d+)\.(\d+).(?P<second>\d+)`)
func main() {
@sundy-li
sundy-li / backup_data.sh
Last active March 29, 2017 00:30
backup_data.sh
#!/bin/bash
## backup use ssh
# bash backup_data.sh /data/tmp/wx.csv wx chuxing@s1:/data/boomer/
source=$1
zip=$2
remote=$3
@sundy-li
sundy-li / gossh
Created March 29, 2017 01:34
gossh
#!/bin/bash
# __________
# /''T''|[___|___]
# Sundyli
# [---T--L-OlllllllO-]
# ooOO2016-08-25 11:47ooOO
# ()_)"""()_)/"**")_) 什么时候才能有辆悍马呢?
# _| _ _ / '| /~~ _ _ _ _ .| _ _ _ _
# _|</(_)(_)(_).|.| (|/(_|| | |(_|||.(_(_)| | |
# / __ _|
@sundy-li
sundy-li / ctx.go
Last active May 7, 2017 11:05
golang-context
package gomarker
type service func() result
func invokeService(ctx content.Content, s service) chan result {
c := make(chan result)
go func() {
c1 := make(chan result)
go func() {
c1 <- s()
@sundy-li
sundy-li / install_zk.sh
Created May 19, 2017 07:06
install_zk_cluster
#!/bin/bash --login
## install zookeeper from url
#env
id=$1
hosts=("server.1=lp2:2888:3888" "server.2=lp3:2888:3888" "server.3=lp4:2888:3888")
version=3.4.10
dir="/data/local"