ITeye博客

雷雨路上

lzyfn123 · 共 238 篇文章

Springboot收集枚举方法

添加注解可以方便修改Key值 @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface AaaAnn { String name() default ""; } 枚举实现的接口 public interface Aabb { static List<Map<String, String>> genDescList(Class<? extends Aabb> enumClass) { Aabb[] vArr = enumClass.getEnumConstants(); return Ar…

2025-11-21T16:03:17Z · Springboot · 评论(0)

Ruby 实现 Java 版本的 PBEWithMD5AndDES 加密:

Ruby 实现 Java 版本的 PBEWithMD5AndDES 加密: def pbeWithMd5AndDes(nickname, passkey, salt) digest = OpenSSL::Digest::MD5.new cipher = OpenSSL::Cipher::Cipher.new("DES") cipher.encrypt cipher.pkcs5_keyivgen(passkey, salt, 1000, digest) encrypted = cipher.update(nickname) encrypted << cipher.final encrypted…

2024-05-14T10:31:52Z · ruby 编程的琢磨 · 评论(0)

EasyExcel自定义Converter 与 Handler

1、Easy Excel(https://easyexcel.opensource.alibaba.com/docs/current/quickstart/write ) @Data public static class CellDataWithStyle { private T val; private Integer flag = 1; CellDataWithStyle(T val) { this.val = val; } } public static class StyleConverter implements Converter { @Override public Clas…

2024-01-25T10:13:20Z · java · 评论(0)

Deepin安装驱动

安装驱动 deepin if you want to use the nvidia please uninstall the debian package ? sudo apt-get --purge remove "*nvidia*" # 卸载nvidia驱动 sudo apt autoremove # 清除遗留文件 sudo service lightdm stop 或 sudo telinit 3 # 启用界面 sudo ./Downloads/NVIDIA-Linux-x86_64-525.105.17.run -no-x-check -no-opengl-files -no-nou…

2023-04-07T23:20:53Z · 操作系统的学习 · 评论(0)

mysql 存储过程实例

mysql 存储过程实例 CREATE PROCEDURE insertValueIntoTestTable (IN m INT) BEGIN DECLARE n INT DEFAULT 0; WHILE n < m DO INSERT INTO `user`.`role` (`name`, `description`) VALUES ('测试', '测试专用'); SET n = n + 1; END WHILE; END; CALL insertValueIntoTestTable(10); DROP PROCEDURE insertValueIntoTestTable; 安装并配置密码…

2023-03-17T14:08:36Z · sql数据库的学习 · 评论(0)

ruby

加密算法 require 'openssl' def data_decrypt(data, key) aes = OpenSSL::Cipher::Cipher.new("AES-128-CBC"); aes.decrypt; aes.key = key; aes.update(data) << aes.final end def data_save(data, file) File.open(file, 'a') { |f| f.write(data) } end def data_read(file) data = "" File.open(file) { |f| data = f.re…

2022-02-12T16:14:29Z · 评论(0)

gem install mysql2

MACOS M1 gem install mysql rbenv exec gem install mysql2 -- \ --with-mysql-lib=/opt/homebrew/Cellar/mysql/8.0.25_1/lib \ --with-mysql-dir=/opt/homebrew/Cellar/mysql/8.0.25_1 \ --with-mysql-config=/opt/homebrew/Cellar/mysql/8.0.25_1/bin/mysql_config \ --with-mysql-include=/opt/homebrew/Cellar/mysql/…

2022-01-07T15:18:26Z · ruby 编程的琢磨 · 评论(0)

虚拟MFA生成

虚拟MFA生成: import cn.hutool.core.codec.Base32; import cn.hutool.crypto.digest.otp.TOTP; import java.time.Instant; import java.util.Date; class MyTotp public static void main(String[] args) { // 每分钟30秒变动 String key = "xxx"; // Base32编码秘钥 TOTP totp = new TOTP(Base32.decode(key)); Instant instant = Inst…

2021-12-18T15:31:27Z · ruby 编程的琢磨 · java代码 · 评论(0)

SSH密码自动登录

brew install hudochenkov/sshpass/sshpass sshpass -p '密码' ssh -p [端口] [服务器] sshpass -f '密码文件' ssh -p [端口] [服务器] sshpass -f '密码文件' -o 2FA_otp ssh -p [端口] [服务器]

2021-12-17T14:51:21Z · 评论(0)

Java 结构处理

Java 结构处理: LinkedHashMap<String, Object> xxx = new LinkedHashMap<>(); List<String> ma = Arrays.asList("6月", "5月", "4月", "3月", "2月", "1月"); Iterator<String> it = ma.iterator(); for (int i = 0; it.hasNext(); i++) { String month = it.next(); ArrayList<Map<String, Object>> list = new ArrayList<Map<Stri…

2021-09-24T16:27:05Z · java代码 · 评论(0)

Ruby 版根据经纬度计算距离

ER = 6378137.0 FL = 1/298.257; def rad(d) d * Math::PI / 180.0 end def calc_distance(lat1, lng1, lat2, lng2) cl1 = rad((lat1 + lat2)/2) cl2 = rad((lat1 - lat2)/2) cl = rad((lng1 - lng2)/2) scl1 = Math.sin(cl1) ** 2 scl2 = Math.sin(cl2) ** 2 scl = Math.sin(cl) ** 2 s = scl2 * (1 - scl) + (1 - scl1) …

2021-08-13T13:52:02Z · 评论(0)

无法访问地址

网址: https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt

2021-03-14T15:58:35Z · linux下工具软件 · 评论(0)

macOS修改MAC地址

macOS修改MAC地址 备份: ip:10.1.14.198 # 10.1.0.1 # 255.255.0.0 # 192.168.1.8 # 192.168.80.88 Mac:78:4f:43:6f:27:59 # 随机生成一个全新的MAC网卡地址 openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//' # 断开无线网卡连接,这时会要求输入开机密码 sudo /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -z # 修改WIFI的MAC地址: …

2021-02-22T17:08:50Z · 操作系统的学习 · 评论(0)

Ruby 字符串连接

Ruby 字符串连接 require 'benchmark' Benchmark.bm do |x| x.report('par') { s2 = '' 1000.times { |i| i = i.to_s; s2 = "#{s2}#{i}" } } x.report('par') { s1 = '' 1000.times { |i| i = i.to_s; s1 += i } } x.report('par') { s3 = '' 1000.times { |i| i = i.to_s; s3 = s3 << i } } end && 1 user system total real p…

2021-01-12T11:15:06Z · ruby 编程的琢磨 · 评论(0)

基于redis实现的锁

代码: class MsgSchedule attr_reader :lock_key, :expire_in, :redis def initialize(lock_key, opts = {}) raise 'lock_key must be exists!' if lock_key.blank? @lock_key = lock_key @expire_in = opts.delete(:expire_in) || 1.minute @redis = opts.delete(:redis) || MSG_BUFFERS_REDIS @opts = opts end def synchr…

2021-01-08T17:43:28Z · ruby 编程的琢磨 · 分布式锁 · 评论(0)