Skip to content

Instantly share code, notes, and snippets.

View DoneSpeak's full-sized avatar
🏊‍♂️

DoneSpeak DoneSpeak

🏊‍♂️
View GitHub Profile
@DoneSpeak
DoneSpeak / useful-regex.md
Created May 26, 2020 09:45
[useful-regex.md] useful regex

正则表达式:工具类之RegexUtils(正则工具类)

/******************** 正则相关常量 ********************/
/**
 * 正则:手机号(简单)
 */
public static final String REGEX_MOBILE_SIMPLE = "^[1]\\d{10}$";
/**
 * 正则:手机号(精确)
@DoneSpeak
DoneSpeak / ImageShrinkWithDpi.java
Created May 7, 2020 12:27
[ImageShrinkWithDpi.java] ImageShrinkWithDpi #java #image
import java.awt.image.BufferedImage;
import java.io.IOException;
import net.coobird.thumbnailator.Thumbnails;
public class ImageShrinkWithDpi {
public static BufferedImage shrink(BufferedImage image, int imgWidthInUserSpaceUnit, int dpi) throws IOException {
int imageWidth = image.getWidth();
@DoneSpeak
DoneSpeak / AddUserAndGrantPrivileges.sql
Last active April 11, 2020 05:41
[AddUserAndGrantPrivileges.sql] Manage users and Grant Privileges of the uses #MySql
------------- 查看用户 -----------
use mysql;
select host,user,password from user;
------------- 查看用户权限 --------
-- 查看本地root的权限,没有指定后面的localhost则默认为'%'
show grants for root@'localhost';
-- 查看指定host的root的权限
show grants for root@'192.168.122.12';
@DoneSpeak
DoneSpeak / ClassUtil.java
Last active April 11, 2020 05:39
[ClassUtil.java] to get the location of a class. #JavaGuide
import java.net.MalformedURLException;
import java.net.URL;
import lombok.extern.slf4j.Slf4j;
/**
* 参考: https://github.com/scijava/scijava-common/blob/scijava-common-2.62.1/src/main/java/org/scijava/util/ClassUtils.java#L296-L355
* @author Yang Guanrong
* @date 2020/04/10 12:30