Skip to content

Instantly share code, notes, and snippets.

View cayzlh's full-sized avatar
🌴
CODE IS POETRY

Ant丶 cayzlh

🌴
CODE IS POETRY
View GitHub Profile
@cayzlh
cayzlh / MapAscSort.java
Last active November 28, 2018 13:46
将Map的字段按字典排序
/**
* 方法用途: 对所有传入参数按照字段名的 ASCII 码从小到大排序(字典序),并且生成url参数串
*
* @param paramsMap 要排序的Map对象
* @param urlEncode 是否需要URLENCODE
* @param keyToLower 是否需要将Key转换为全小写 true:key转化成小写,false:不转化
* @return
*/
public static String formatUrlMap(Map<String, Object> paramsMap, boolean urlEncode, boolean keyToLower) {
@cayzlh
cayzlh / nginx-xxx.conf
Created November 5, 2018 07:24
nginx配置文件
# rewrite to Https
server {
listen 80;
server_name xxx.xxx.com;
rewrite ^(.*)$ https://$host$1 permanent;
}
server {
listen 443 ssl;
@cayzlh
cayzlh / springboot-start.sh
Created November 5, 2018 06:53
springboot项目启动脚本
#!/bin/sh
appName=yourAppName
pidFile="$appName.pid"
start(){
if [ -f "$pidFile" ]; then
pid=$(cat "$pidFile")
echo "STOP pid:$pid"
kill -9 $pid
@cayzlh
cayzlh / springboot_auto_deploy.sh
Created November 5, 2018 06:53
springboot自动部署脚本, 可用于Jenkins
#!/bin/bash
# description:springboot 自动部署 1.0版本
# version 1.0
show_usage="args: [-t]\[--deploy-type=]"
#版本部署路径
mainpath=/data/service/youAppDir
# 应用名称
appName=yourAppName
@cayzlh
cayzlh / shadowsocks.sh
Created October 9, 2018 10:02
shadowsocks服务端一键安装脚本(备份)
#!/usr/bin/env bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
#=================================================================#
# System Required: CentOS 6+, Debian 7+, Ubuntu 12+ #
# Description: One click Install Shadowsocks-Python server #
# Author: Teddysun <i@teddysun.com> #
# Thanks: @clowwindy <https://twitter.com/clowwindy> #
# Intro: https://teddysun.com/342.html #
#=================================================================#
@cayzlh
cayzlh / AppletAesUtils.java
Last active September 25, 2018 02:07
微信小程序数据Aes加密解密工具类(官方示例居然没有Java语言的)
package com.cayzlh.applets.utils;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.security.Key;
import java.security.Security;
import java.util.Arrays;
@cayzlh
cayzlh / web.xml
Last active September 5, 2017 10:29
web.xml 常用配置
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
metadata-complete="true" version="3.0">
<display-name>Archetype Created Web Application</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
@cayzlh
cayzlh / centos6.5_nginx
Created August 22, 2017 14:57 — forked from ifels/centos6.5_nginx
centos 6.5 nginx安装与配置
第一步,在/etc/yum.repos.d/目录下创建一个源配置文件nginx.repo:
cd /etc/yum.repos.d/
vim nginx.repo
填写如下内容:
[nginx]
name=nginx repo
@cayzlh
cayzlh / xxx-xx-com.conf
Created August 22, 2017 14:50
nginx配置文件,一个域名对应多个Tomcat项目
upstream tomcat1 {
server 127.0.0.1:8080 weight=10;
#fair;
}
upstream tomcat2 {
server 127.0.0.1:8081 weight=10;
#fair;
}