首页
统计
留言板
直播
更多
壁纸
推荐
Git仓库
Search
1
IntelliJ IDEA激活 - 至2022年10月 (持续更新)
645 阅读
2
GitLab企业版搭建(附生成证书)
626 阅读
3
淘宝 京东秒杀脚本
422 阅读
4
Groovy模板引擎 API 构建动态脚本
324 阅读
5
欢迎使用 Typecho
294 阅读
杂货间
开发
Java
JavaScript
Android
JQuery
MySQL
PHP
Groovy
Git
运维
CentOS
Red Heat
Ubuntu
Debian
运行环境
登录
/
注册
Search
标签搜索
开发
Java
Android
MySQL8
CentOS
CentOS8
Linux
Git
Swing
JavaScript
JQuery
MySQL
临时手机号
IDEA
Steam
YouTube
订阅
激活码
GitLab
nginx
Dotdotmaples
累计撰写
30
篇文章
累计收到
7
条评论
首页
栏目
杂货间
开发
Java
JavaScript
Android
JQuery
MySQL
PHP
Groovy
Git
运维
CentOS
Red Heat
Ubuntu
Debian
运行环境
页面
统计
留言板
直播
壁纸
推荐
Git仓库
搜索到
8
篇与
杂货间
的结果
Spring Data JPA学习笔记
Spring Data JPASpring Data JPA关联关系Spring Data JPA多对多结论实际开发时应避免直接返回entity,当关系处理不当容易出现联级关系上的死循环 多对多关系中的联级操作(在School中的students添加CascadeType):PERSIST、MERGE、REMOVE、REFRESH、DETACH PERSIST - 级联持久化(保存)操作 - 保存当前实体(School)时,与它有映射关系的实体(Student)也会跟着被删除, 当需要持久化的实体(School)中映射关系的实体(Student)已经存在于数据库,则需要使用(JpaRepository.getReferenceById)查询出的实体(Student)进行保存 MERGE - 级联更新(合并)操作 - 当保存的实体(School)时,与它有映射关系的实体(Student)改变,会相应地更新联级属性(Student)中的数据 REMOVE - 级联删除操作 - 删除当前实体(School)时,与它有映射关系的实体(Student)也会跟着被删除 若Student中的schools也添加CascadeType.REMOVE,则关联的School也会被删除,而删除School时也会同时删除School关联的Student REFRESH - 级联刷新操作 DETACH - 级联脱管/游离操作Student.javapackage org.fengling.study.spring.data.jpa.bean.entity; import lombok.Getter; import lombok.Setter; import javax.persistence.*; import java.io.Serial; import java.io.Serializable; import java.util.Set; @Getter @Setter @Entity @Table(name = "student") public class Student implements Serializable { @Serial private static final long serialVersionUID = -2228784815938588107L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "[student_id]") private Integer studentId; @Column(name = "[school_name]") private String studentName; @ManyToMany(mappedBy = "students") private Set<School> schools; }School.javapackage org.fengling.study.spring.data.jpa.bean.entity; import com.fasterxml.jackson.annotation.JsonBackReference; import lombok.Getter; import lombok.Setter; import javax.persistence.*; import java.util.Set; @Getter @Setter @Entity @Table(name = "school") public class School { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "[school_id]") private Integer schoolId; @Column(name = "[school_name]") private String schoolName; @ManyToMany(cascade = {CascadeType.MERGE, CascadeType.REMOVE, CascadeType.REFRESH, CascadeType.PERSIST}) @JoinTable( name = "school_student", joinColumns = @JoinColumn(name = "[school_id]", referencedColumnName = "[school_id]"), inverseJoinColumns = @JoinColumn(name = "[student_id]", referencedColumnName = "[student_id]") ) @JsonBackReference // 解决Entity转JSON时无限循环的问题 private Set<Student> students; } 数据库结果school_idschool_name3school031school01student_idstudent_name3school032school021school01school_idstudent_id11121332
2022年09月24日
96 阅读
0 评论
0 点赞
Typora激活
关于此篇文章阅读前的说明此篇文章(下称“本文”)内容仅供学习,不可用于实际操作。若有按照本文进行实操并产生相关利害冲突的,与本站无关。如有异议请联系本站管理员进行删除不赞同以上观点者请关闭本文链接并删除从此站点下载的一切资源下载Typora下载最新版的Typora为避免下叙操作失败,也可下载作者提前准备好的版本 提取码: po93覆盖配置文件将 app.asar.txt 文件名中的“.txt”去掉,并覆盖至安装路径的“resources”文件夹内注册Typora打开 typora,输入网盘中提前准备好的注册码
2022年06月06日
83 阅读
0 评论
0 点赞
GitLab企业版搭建(附生成证书)
GitLab企业版搭建(附生成证书)GitLab官方文档部分内容摘自 【CSDN】万wu皆可爱安装GitLab EE安装环境 Raspberry Pi 4 8G (Rocky 8.5) root用户安装一些依赖支持# 若是没有安装完成也是没有啥子问题的(我的policycoreutils-python就没安装完成,包都没找着),不过前提是安装正常 yum install -y curl policycoreutils-python openssh-server perl检查ssh服务# 设置自启并开启ssh服务,这东西吧,我都能连服务器了,当然就是开着的,就当走个过场 systemctl enable sshd systemctl start sshd设置防火墙# 检查防火墙,查看防火墙状态可以用: systemctl status firewalld firewall-cmd --permanent --add-service=http firewall-cmd --permanent --add-service=https systemctl reload firewalld # 当然,也可以用简单粗暴的方法 systemctl stop firewalld systemctl disable firewalld配置邮件服务器我这里推荐postfix, 当然也可以用其他的,比如SMTP等, SMTP服务可以参考官方的文档# 安装postfix yum install postfix # 设置自启 systemctl enable postfix # 启动postfix systemctl start postfix下载并安装gitlab-ee rpm软件包(2种方式)通过官方脚本安装curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash下载RPM包手动安装rpm -ivh gitlab-ee-14.0.5-ee.0.el7.x86_64.rpm安装GitLabEXTERNAL_URL ="http://gitlab.example.com" yum install -y gitlab-ee # http://gitlab.example.com为安装后访问的地址,如果是https的,那么在安装的时候会自动申请Let’s Encrypt的免费证书登陆默认用户名是root, 密码在/etc/gitlab/initial_root_password这个文件里生成证书安装2.3版本以上的rubyyum install ruby # 查看版本 ruby -v安装GitLab的证书包gem install gitlab-license创建生成证书的ruby源文件源文件参考vi license.rb # 以下为源文件内容 require "openssl" require "gitlab/license" key_pair = OpenSSL::PKey::RSA.generate(2048) File.open("license_key", "w") { |f| f.write(key_pair.to_pem) } public_key = key_pair.public_key File.open("license_key.pub", "w") { |f| f.write(public_key.to_pem) } private_key = OpenSSL::PKey::RSA.new File.read("license_key") Gitlab::License.encryption_key = private_key license = Gitlab::License.new license.licensee = { "Name" => "gitlab", "Company" => "GitLab", "Email" => "gitlab@gitlab.com", } # 开始时间 license.starts_at = Date.new(2020, 1, 1) # 结束时间 license.expires_at = Date.new(2050, 1, 1) license.notify_admins_at = Date.new(2049, 12, 1) license.notify_users_at = Date.new(2049, 12, 1) license.block_changes_at = Date.new(2050, 1, 1) license.restrictions = { active_user_count: 10000, } puts "License:" puts license data = license.export puts "Exported license:" puts data File.open("GitLabBV.gitlab-license", "w") { |f| f.write(data) } public_key = OpenSSL::PKey::RSA.new File.read("license_key.pub") Gitlab::License.encryption_key = public_key data = File.read("GitLabBV.gitlab-license") $license = Gitlab::License.import(data) puts "Imported license:" puts $license unless $license raise "The license is invalid." end if $license.restricted?(:active_user_count) # 用户数 active_user_count = 10000 if active_user_count > $license.restrictions[:active_user_count] raise "The active user count exceeds the allowed amount!" end end if $license.notify_admins? puts "The license is due to expire on #{$license.expires_at}." end if $license.notify_users? puts "The license is due to expire on #{$license.expires_at}." end module Gitlab class GitAccess def check(cmd, changes = nil) if $license.block_changes? return build_status_object(false, "License expired") end end end end puts "This instance of GitLab Enterprise Edition is licensed to:" $license.licensee.each do |key, value| puts "#{key}: #{value}" end if $license.expired? puts "The license expired on #{$license.expires_at}" elsif $license.will_expire? puts "The license will expire on #{$license.expires_at}" else puts "The license will never expire." end生成证书ruby license.rb # 执行完成后会生成如下三个文件 # GitLabBV.gitlab-license|license_key|license_key.pub # 第一个是证书,第二个是私钥,第三个是公钥使用许可证# 用license_key.pub替换/opt/gitlab/embedded/service/gitlab-rails/.license_encryption_key.pub # 重启GitLab gitlab-ctl -restart # 访问${address}/admin/license/new并用生成的GitLabBV.gitlab-license文件上传 #或者 ${address}/admin/license修改证书等级vi /opt/gitlab/embedded/service/gitlab-rails/ee/app/models/license.rb # 将 # restricted_attr(:plan).presence || STARTER_PLAN # 替换成 # restricted_attr(:plan).presence || ULTIMATE_PLAN # 重新加载配置 gitlab-ctl reconfigure配置与操作相关命令启动全部服务gitlab-ctl start重启全部服务gitlab-ctl restart停止全部服务gitlab-ctl stop重启单个服务,如重启nginxgitlab-ctl restart nginx查看服务状态gitlab-ctl status使配置文件生效gitlab-ctl reconfigure验证配置文件gitlab-ctl show-config删除gitlab(保留数据)gitlab-ctl uninstall删除所有数据,从新开始gitlab-ctl cleanse查看服务的日志gitlab-ctl tail <service name> # 如查看gitlab下nginx日志 gitlab-ctl tail nginx进入控制台gitlab-rails consoleGitlab反向代理默认情况下,Omnibus GitLab 会自动检测是否使用 SSL(如果包含 NGINX 并将其配置为 SSL 终端)。但是,如果将 GitLab 配置为在反向代理或外部负载均衡器后面运行,则某些环境可能希望在 GitLab 应用程序外部终端部署 SSL。vi etc/gitlab/gitlab.rb nginx['listen_port'] = 80 nginx['listen_https'] = false external_url 'https://git.fengling.org'关闭 Gitlab 组件由于 Gitlab 核心功能是代码托管,所以有些额外的组件比较浪费资源,所以可以考虑关闭。prometheus['enable'] = false prometheus['monitor_kubernetes'] = false alertmanager['enable'] = false node_exporter['enable'] = false redis_exporter['enable'] = false postgres_exporter['enable'] = false gitlab_exporter['probe_sidekiq'] = false prometheus_monitoring['enable'] = false grafana['enable'] = false 初始化 Gitlab 组件第一次需要初始化 gitlab 服务,后续如果对 gitlab配置文件进行修改,也需要执行初始化进行重新配置。gitlab-ctl reconfigure gitlab-ctl status gitlab-ctl stop gitlab-ctl start验证 Gitlab 组件重新初始化后通过 gitlab-rails 检查 gitlab 邮箱是否可正常使用。# 打开控制台 gitlab-rails console # 发送邮件 Notify.test_email('dotdotmaples@163.com','test','gitlab').deliver_now日常维护备份修改默认存放备份站点目录,然后进行重新加载配置文件vim /etc/gitlab/gitlab.rb # 自定义备份路径 gitlab_rails['backup_path'] = "/data/gitlab/backups" # 保留7天 gitlab_rails['backup_keep_time'] = 604800 mkdir /data/gitlab/backups -p手动执行备份命令,会将备份的结果存储至/data/gitlab/backups 目录中gitlab-rake gitlab:backup:create # 也可以将备份命令写入定时任务每天进行自动备份 crontab -l 00 03 * * * /usr/bin/gitlab-rake gitlab:backup:create数据恢复当误删除项目,或者误删除用户等数据时候,如果之前有备份,那么可以做恢复操作。停止数据写入服务gitlab-ctl stop unicorn gitlab-ctl stop sidekiq通过 gitlab-rake 命令进行恢复,恢复时需要指定此前备份的名称。(但不需要写名称的.tar后缀)gitlab-rake gitlab:backup:restore BACKUP=1634715076_2021_10_20_12.3.0重启gitlab,检测是否 gitlab 是否恢复。gitlab-ctl restart迁移升级一般情况,gitlab一经使用,则不会升级;除非做迁移,例如从本地环境迁移到阿里云时,可以顺便升级;一般情况下,迁移会迁移两个文件,/etc/gitlab/gitlab.rb 和backups下的备份文件。在新节点需要安装相同的版本,先恢复数据数据恢复后先升级到本版本的最后一个版本,然后再升级到下个版本,例如(12.3 —> 12.9.9 --> 13),不能跨版本升级。如果从12 最后一个版本升级到13 ,会报错yum localinstall gitlabce-13.0.10-ce.0.el7.x86_64.rpm -y #会提示报错: Running transaction * gitlab_monitor['enable'] has been deprecated since 12.3 and was removed in 13.0. Use gitlab_exporter['enable'] instead.只需要根据提示编辑 /etc/gitlab.rb 配置文件#提示什么错变更什么即可 gitlab_monitor['enable'] =false gitlab_exporter['enable'] = false修改配置后重新初始化,然后在进行升级gitlab-ctl reconfigure yum localinstall gitlabce-13.0.10-ce.0.el7.x86_64.rpm -y安全将访问网页的 HTTP 协议升级到 HTTPS协议,保证数据安全;阿里云上申请下载nginx证书到/ssh_key文件夹mkdir -p /ssl_key修改 Gitlab 配置文件vim /etc/gitlab/gitlab.rb external_url "https://gitlab.bertwu.online" # 必须修改 nginx['enable'] = true nginx['client_max_body_size'] = '1000m' nginx['redirect_http_to_https'] = true nginx['redirect_http_to_https_port'] = 80 # 所有请求80的都跳转到443 nginx['ssl_certificate'] = "/ssl_key/server.crt" nginx['ssl_certificate_key'] = "/ssl_key/server.key" nginx['ssl_ciphers'] = "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256" nginx['ssl_prefer_server_ciphers'] = "on" nginx['ssl_protocols'] = "TLSv1.2" nginx['ssl_session_cache'] = "builtin:1000 nnshared:SSL:10m" nginx['ssl_session_timeout'] = "1440m"重新初始化 Gitlabgitlab-ctl reconfigure忘记密码如何重置 GitLab的 root 密码 官方修改密码方式在 root 用户下,执行gitlab-rails console -e production -------------------------------------------------------------------------------- GitLab: 12.3.0 (4fcd588b89f) GitLab Shell: 10.0.0 PostgreSQL: 10.9 --------------------------------------------------------------------------------获得用户数据,修改用户密码irb(main):001:0> user=User.where(id:1).first => #<User id:1 @root> #更改密码并确认密码 irb(main):002:0> user.password="12345678" => "12345678" irb(main):003:0> user.password_confirmation="12345678" => "12345678" #保存退出 irb(main):004:0> user.save! Enqueued ActionMailer::DeliveryJob (Job ID: 07420155-1ccb-44a5-9b1c-c74e0253f253) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", #<GlobalID:0x00007f6ee7794b38 @uri=#<URI::GID gid://gitlab/User/1>> => true irb(main):005:0> quit
2021年07月12日
626 阅读
0 评论
11 点赞
淘宝 京东秒杀脚本
淘宝秒杀脚本配合Tampermonkey使用// ==UserScript== // @name 淘宝秒杀脚本 // @namespace https://fengling.site/ // @version 0.1 // @description 淘宝秒杀脚本, 干翻黄牛! // @author dotdotmaples // @match https://cart.taobao.com/cart.htm* // @match https://buy.tmall.com/order/confirm_order.htm* // @grant none // ==/UserScript== (function() { 'use strict' let inv_main = setInterval(() => { let orderButtons = document.getElementsByClassName('go-btn'); let cartButton = document.getElementById('J_Go'); if(orderButtons.length > 0) { // 确认订单界面 orderButtons[0].click(); console.log('确认订单'); clearInterval(inv_main); }else if(cartButton != null && cartButton.classList.length == 1) { // 购物车界面 console.log('等待秒杀'); let time = new Date('2021-01-11 15:40:00').getTime(); let inv = setInterval(() => { if(new Date().getTime() >= time) { document.getElementById('J_Go').click(); console.log('开始秒杀'); clearInterval(inv); } }, 10); clearInterval(inv_main); }else { // 页面未加载完成或未选择抢购商品 console.log('页面未加载完成或未选择抢购商品'); } }, 10) })();京东秒杀脚本配合Tampermonkey使用// ==UserScript== // @name JD秒杀脚本 // @namespace https://fengling.site/ // @version 0.1 // @description JD秒杀脚本, 干翻黄牛! // @author dotdotmaples // @match https://cart.jd.com/cart_index* // @match https://trade.jd.com/shopping/order/getOrderInfo.action* // @grant none // ==/UserScript== (function() { 'use strict' let inv_main = setInterval(() => { let orderButton = document.getElementById('order-submit'); let cartButtons = document.getElementsByClassName('common-submit-btn'); if(orderButton != null) { // 确认订单界面 // 直接调用JD官方函数 submit_Order(1); //orderButton.click(); console.log('确认订单'); clearInterval(inv_main); }else if(cartButtons.length > 0) { // 购物车界面 console.log('等待秒杀'); let time = new Date('2021-01-11 16:11:00').getTime(); let inv = setInterval(() => { if(new Date().getTime() >= time) { cartButtons[0].click(); console.log('开始秒杀'); clearInterval(inv); } }, 10); clearInterval(inv_main); }else { // 页面未加载完成或未选择抢购商品 console.log('页面未加载完成或未选择抢购商品'); } }, 10) })();
2021年01月11日
422 阅读
0 评论
0 点赞
2020-12-20
HTTP状态码
HTTP状态码
2020年12月20日
87 阅读
0 评论
0 点赞
IntelliJ IDEA激活 - 至2022年10月 (持续更新)
IDEA
2020年01月06日
645 阅读
0 评论
9 点赞
临时手机号
国内免费临时手机号:https://sms.cmhttps://www.pdflibr.comhttps://www.becmd.comhttp://www.smszk.com国外免费临时手机号:https://zh.mytrashmobile.com(中文)https://ch.freephonenum.com(中文)SMSReceiveFree:https://smsreceivefree.comReceive SMS Online for FREE:https://www.receive-sms-online.infoReceive a SMS Online:https://receive-a-sms.comFree SMS Numbers Online:https://smsnumbersonline.comReceive SMS online for Free:https://sms-online.co/receive-free-smsReceive-SMS:https://receive-sms.comReceive FREE SMS online:http://receivefreesms.comRECEIVE SMS ONLINE:https://www.receivesmsonline.netFree Online Phone:https://www.freeonlinephone.orgReceive SMS Online:http://receive-sms-online.comTextNow:https://www.textnow.comTextfree:https://www.pinger.com/text-free/SELLAITE:http://sms.sellaite.com/Twilio:https://www.twilio.com/https://receive-sms.com/http://receive-sms-online.com/http://sms.sellaite.com/http://hs3x.com/http://receivefreesms.nethttp://receivesmsonline.inhttp://www.receive-sms-now.comhttps://sms-receive.nethttps://www.receivesms.nethttp://www.freesmsverifications.comhttp://receiveonlinesms.bizhttp://receivesmsverification.comhttps://www.receivesms.cohttp://receiveonlinesms.com
2019年11月26日
72 阅读
0 评论
0 点赞
2019-01-01
欢迎使用 Typecho
如果您看到这篇文章,表示您的 blog 已经安装成功.
2019年01月01日
294 阅读
0 评论
0 点赞