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
@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 / 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 / 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 / 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 / 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
#!/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")