Skip to content

Instantly share code, notes, and snippets.

@abel533
abel533 / AIJournalist.java
Created April 10, 2024 03:19
使用 Spring AI 参考 https://github.com/mshumer/ai-journalist 实现的 AI 记者
package io.mybatis.ai;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.springframework.ai.chat.ChatClient;
import org.springframework.ai.chat.ChatResponse;
import org.springframework.ai.chat.messages.Message;
import org.springframework.ai.chat.messages.SystemMessage;
import org.springframework.ai.chat.messages.UserMessage;
import org.springframework.ai.chat.prompt.Prompt;
@abel533
abel533 / notranslate.user.js
Last active March 7, 2022 03:34
浏览器翻译时排除代码片段
// ==UserScript==
// @name notranslate
// @namespace https://gist.github.com/abel533/5839d3eca4686646baba113fc47e9b22
// @version 1.0
// @description 浏览器翻译时排除代码片段
// @author isea533
// @match *://**/*
// @grant none
// ==/UserScript==
@abel533
abel533 / ansible.cfg
Created April 11, 2020 10:17
Ansible Default file
# config file for ansible -- https://ansible.com/
# ===============================================
# nearly all parameters can be overridden in ansible-playbook
# or with command line flags. ansible will read ANSIBLE_CONFIG,
# ansible.cfg in the current working directory, .ansible.cfg in
# the home directory or /etc/ansible/ansible.cfg, whichever it
# finds first
[defaults]
#!/bin/bash
#
# tomcat startup script for the Tomcat server
#
#
# chkconfig: 345 80 20
# description: start the tomcat deamon
#
# Source function library
. /etc/rc.d/init.d/functions
/**
* guid模块提供生成唯一值ID,用于token生成等。
* @module guid
*/
module.exports = {
create: function() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random() * 16 | 0,
v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
@abel533
abel533 / Free O'Reilly Books.md
Created February 28, 2018 01:12 — forked from augbog/Free O'Reilly Books.md
Free O'Reilly Books

Free O'Reilly books and convenient script to just download them.

Thanks /u/FallenAege/ and /u/ShPavel/ from this Reddit post

How to use:

  1. Take the download.sh file and put it into a directory where you want the files to be saved.
  2. cd into the directory and make sure that it has executable permissions (chmod +x download.sh should do it)
  3. Run ./download.sh and wee there it goes. Also if you do not want all the files, just simply comment the ones you do not want.
@abel533
abel533 / jdbc.properties
Created October 21, 2017 03:12
JDBC-mysql6.x-配置
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/testdb?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC&zeroDateTimeBehavior=round&allowMultiQueries=true
jdbc.username=root
jdbc.password=xx
@abel533
abel533 / poi-excel-formula-cal.java
Created October 17, 2017 08:22
Excel计算公式 #excel
//https://poi.apache.org/spreadsheet/eval.html
//Using FormulaEvaluator.evaluateFormulaCell(Cell cell)
FileInputStream fis = new FileInputStream("/somepath/test.xls");
Workbook wb = new HSSFWorkbook(fis); //or new XSSFWorkbook("/somepath/test.xls")
Sheet sheet = wb.getSheetAt(0);
FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator();
// suppose your formula is in B3
CellReference cellReference = new CellReference("B3");
Row row = sheet.getRow(cellReference.getRow());
@abel533
abel533 / poi-excel-merge.java
Last active October 16, 2017 02:12 — forked from davidsommer/mergeExcel.java
POI-合并Excel为多sheet页
public static void mergeExcelFiles(File file, List<FileInputStream> list) throws IOException {
HSSFWorkbook book = new HSSFWorkbook();
HSSFSheet sheet = book.createSheet(file.getName());
for (FileInputStream fin : list) {
HSSFWorkbook b = new HSSFWorkbook(fin);
for (int i = 0; i < b.getNumberOfSheets(); i++) {
copySheets(book, sheet, b.getSheetAt(i));
}
}