This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.diaolizhi.mybatisdemo.utils; | |
import com.diaolizhi.mybatisdemo.domain.User; | |
import io.jsonwebtoken.Claims; | |
import io.jsonwebtoken.Jwts; | |
import io.jsonwebtoken.SignatureAlgorithm; | |
import java.util.Date; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.Serializable; | |
/** | |
* 功能描述:工具类 | |
* | |
* <p> 创建时间:May 14, 2018 7:58:06 PM </p> | |
*/ | |
public class JsonData implements Serializable { | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<nav class="navbar navbar-light navbar-expand-md navigation-clean-button"> | |
<div data-toggle="collapse" data-target=".navbar-collapse.show" class="container"><router-link class="navbar-brand" to="/">首页</router-link><button class="navbar-toggler" data-toggle="collapse" data-target="#navcol-1"><span class="sr-only">Toggle navigation</span><span class="navbar-toggler-icon"></span></button> | |
<div class="collapse navbar-collapse" | |
id="navcol-1"> | |
<ul class="nav navbar-nav mr-auto"> | |
<li class="nav-item" role="presentation"><router-link class="nav-link" to="/see-other-forum-list">查贴吧</router-link></li> | |
<li class="nav-item" role="presentation"><a class="nav-link" href="#">Second Item</a></li> | |
<li class="dropdown"><a class="dropdown-toggle nav-link dropdown-toggle" data-toggle="dropdown" aria-expanded="false" href="#">Dropdown</a> | |
<div class="dropdown-menu" role="menu"><a class="dropdown-item" role="presentation" href= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.security.SecureRandom; | |
import java.util.Locale; | |
import java.util.Objects; | |
import java.util.Random; | |
public class RandomString { | |
/** | |
* Generate a random string. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Insert("INSERT INTO t_email_link VALUES (#{email}, #{link}, DATE_ADD(CURDATE(), INTERVAL 2 DAY))" + | |
"ON DUPLICATE KEY UPDATE link=#{link}, exp=DATE_ADD(CURDATE(), INTERVAL 2 DAY)") | |
void saveEmailAndChangePasswordLink(@Param("email") String email, @Param("link") String link); | |
//重点是 ON DUPLICATE KEY UPDATE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Insert("INSERT IGNORE INTO t_user " + | |
"(email, password, salt, is_active) " + | |
"VALUES (#{email}, #{password}, #{salt}, 1)") | |
int addUser(TUser user); | |
//重点是 IGNORE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 项目名 | |
PRONAME="demo" | |
#echo $PRONAME | |
# 项目所在路径 | |
PROPATH='/root/tieba-demo/Tieba/' | |
nohup git pull origin master >/dev/null 2>&1 | |
#git pull origin master | |
cd $PROPATH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ReloadSystem { | |
public static void reloadSystem() { | |
ProcessBuilder processBuilder = new ProcessBuilder(); | |
processBuilder.command("bash", "-c", "bash ~/tieba-demo/Tieba/reload.sh"); | |
try { | |
Process process = processBuilder.start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 创建 Map | |
Map<String, String> map = new HashMap<>(); | |
// 添加元素 | |
map.put("1", "张三"); | |
map.put("2", "李四"); | |
map.put("3", "王五"); | |
// 获取存放键值的集合 | |
// Map 并没有 iterator 方法,所以不能 map.iterator() 获取迭代器 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String decrypt(String encrypted) { | |
String KEY = ")O[NB]6,YF}+efcaj{+oESb9d8>Z'e9M"; | |
String IV = "L+\\~f4,Ir)b$=pkf"; | |
try { | |
IvParameterSpec iv = new IvParameterSpec(IV.getBytes("UTF-8")); | |
SecretKeySpec skeySpec = new SecretKeySpec(KEY.getBytes("UTF-8"), "AES"); | |
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING"); | |
cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv); |