Skip to content

Instantly share code, notes, and snippets.

View corkine's full-sized avatar
🎯
Focusing

corkine

🎯
Focusing
View GitHub Profile
@corkine
corkine / auto_cert.clj
Created March 6, 2025 00:53
acme.sh sign https cert by using cloudflare api, deploy to aliyun cas, oss and dcdn
#_{:paths ["src"]
:deps {cheshire/cheshire {:mvn/version "5.10.0"}
luminus-http-kit/luminus-http-kit {:mvn/version "0.1.9"}
com.aliyun/cas20200407 {:mvn/version "3.0.0"}
com.aliyun/dcdn20180115 {:mvn/version "2.5.0"}
com.aliyun.oss/aliyun-sdk-oss {:mvn/version "3.18.1"}}
(ns auto-cert
"使用 acme.sh 和 Cloudflare DNS API 自动签发证书,
使用阿里云证书管理服务管理,配置给 DCDN 加速和 OSS 存储桶使用。"
(:require
@corkine
corkine / clojure-prom-metric.clj
Created November 21, 2024 07:38
clojure web app impl prometheus exporter using reitit, swagger, mount, iapetos
(ns cyberme.db.metric
(:require
[clojure.string :as str]
[clojure.tools.logging :as log]
[iapetos.collector.exceptions :as ex]
[iapetos.collector.jvm :as jvm]
[iapetos.collector.ring :as ring]
[iapetos.collector.fn :as fnn]
[iapetos.core :as api]
[iapetos.export :as export]
@corkine
corkine / page_with_auth.clj
Last active August 22, 2023 01:21
Simple authentication and page service based on Clojure Ring Spec, relying on Redis
;the first visit requires a password through JS, and then JS is passed in through QueryParam,
;after successful authentication, the set-cookie jumps to the redirection page, and the token is
;saved in redis. The redirection page clears the QueryParam and returns to the original page with
;the cookie to access the protected resource. As long as the service is accessed within the validity period of the token,
;the token expiration time can be extended, and the maximum time is the cookie expiration time.
;you can use post and custom redirectiong page to avoid trans password in queryParam if you need.
(ns we
(:require [clojure.edn :as edn]
[cyberme.config :refer [edn-in]]
[cyberme.layout :as layout]
@corkine
corkine / cloudflare_worker_cache_api.js
Last active February 22, 2023 03:18
Cloudflare Worker for Proxy, Cache and Protected Source Site's Static Resource
/**
* Welcome to Cloudflare Workers! This is your first worker.
*
* - Run `npx wrangler dev src/index.js` in your terminal to start a development server
* - Open a browser tab at http://localhost:8787/ to see your worker in action
* - Run `npx wrangler publish src/index.js --name my-worker` to publish your worker
*
* Learn more at https://developers.cloudflare.com/workers/
*/
@corkine
corkine / AlipayImporter.scala
Last active October 10, 2019 06:49
AlipayRecorderUploader - Scala 实现 - 支付宝 CSV 记录上传到数据库
import java.io.File
import java.nio.file.Paths
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import dao.DatabaseModule
import dao.Entity.AliRecord
import slick.jdbc.MySQLProfile
import scala.io.Source
@corkine
corkine / FindStringInDocxFiles_MavenScala.scala
Last active October 9, 2019 15:29
从文件夹的 docx 文档中并行搜索某个关键字 - Scala 实现 - Maven 工程
import java.io.{File, IOException}
import java.nio.file._
import java.nio.file.attribute.BasicFileAttributes
import org.docx4j.Docx4J
import org.slf4j.LoggerFactory
import scala.collection.mutable.ArrayBuffer
object Find extends App {