Skip to content

Instantly share code, notes, and snippets.

View iamspark1e's full-sized avatar
🎶
The Real Folk Blues

Wenbo iamspark1e

🎶
The Real Folk Blues
View GitHub Profile

README

Reference: https://github.com/hkfires/Keep-Serv00-Alive

这个方案利用了Serv00自带Apache服务器的Phusion Passenger插件功能,每次访问网页时可以唤醒Nodejs程序,因而不需要借助Cron就能够进行保活,自然没有了被杀Cron计划任务的烦扰

  1. 删除自带的域带有的网站,<your_username>.serv00.net,勾选“Delete(purge website files)”
  2. 重新添加<your_username>.serv00.net,选择Advanced,类型选择Nodejs,使用最高版本如Node V22
  3. SSH,前往目录 ~/domains/<your_username>.serv00.net/public_nodejs
  4. 由于Serv00的Apache设置的是静态优先,因而此处public文件夹下不能有index.html,否则会显示静态页面,而不会执行nodejs程序,我选择的是直接将public改名为static,执行mv public static
@iamspark1e
iamspark1e / gen-selfsign-ssl-with-san.sh
Created January 6, 2025 09:43
生成支持配置SAN的自签证书
#!/bin/sh
# create self-signed server certificate with SAN support:
read -p "Enter your domain [www.example.com]: " DOMAIN
read -p "Enter additional domains (space separated) or press enter to skip: " ADDITIONAL_DOMAINS
# Create OpenSSL config file
cat > openssl.cnf << EOF
[req]
@iamspark1e
iamspark1e / rollup.config.js
Created September 29, 2024 07:20
IE9 compatible rollup config. 兼容IE9的Rollup配置
// npm install --save-dev rollup @rollup/plugin-babel @rollup/plugin-node-resolve @rollup/plugin-commonjs @babel/core @babel/preset-env core-js regenerator-runtime
// npm install --save core-js regenerator-runtime
/**
* IE9 compatible rollup config
*/
import babel from '@rollup/plugin-babel';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
@iamspark1e
iamspark1e / README.md
Created June 9, 2024 16:10 — forked from balupton/README.md
Upload a File to Cloudflare R2 Instructions
// boj转换url参数
const parseParam = (param, encode) => {
let s = []
const add = (key, val = '') => {
let _param = encode ? `${encodeURIComponent(key)}=${encodeURIComponent(val)}` : `${key}=${val}`
s[s.length] = _param
}
if (Array.isArray(param)) {
param.forEach((v, i) => add(i, v))
} else {
@iamspark1e
iamspark1e / alpinejs-template.html
Last active June 11, 2024 08:35
CDN mode alpinejs v3 + Daisy UI + dayjs template.
<html lang="en" data-theme="emerald">
<head>
<title>Demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="https://cdn.jsdelivr.net/npm/daisyui@4.11.1/dist/full.min.css" rel="stylesheet" type="text/css" />
<script src="https://cdn.tailwindcss.com"></script>
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/dayjs@1/dayjs.min.js"></script>
<style></style>
type WatermarkCanvasConfigurableOptions = {
textAlign?: string,
textBaseline?: string,
font?: string,
fillStyle?: string,
}
type WatermarkConfiguration = {
container: HTMLElement | null,
id: string,
@iamspark1e
iamspark1e / vue-stepper-with-unit.vue
Created November 30, 2023 08:03
My custom vue components
<template>
<div class="demo">
<button type="button" @click="minus" :disabled="value <= min">-</button>
<label>
<span v-show="!focused">{{ value }}{{ unit }}</span>
<input
type="number"
pattern="[0-9]*"
ref="realInput"
v-model.number="value"
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<!-- <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script> -->
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@2.8.2/dist/alpine.min.js"></script>
</head>
// fit for concat html property
function escapeQuotes(raw, escape_double, escape_single) {
if(escape_double) raw = raw.replace(/"/g, "&quot;");
if(escape_single) raw = raw.replace(/'/g, "\'");
return raw;
}