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
@cryptoskillz
cryptoskillz / gist:98b8e7090b7cc8d51531bb9dcfe7654a
Created December 5, 2021 16:48
Tips on how to use a KV namespace with Cloudflare Pages
This gist aims to show you how to use KV datastore using Cloudflare pages. The reason I created this quick guide is it took
me almost 2 weeks to get it working, mainly because it is very new and the documentation is not up fully fleshed out yet
https://developers.cloudflare.com/workers/runtime-apis/kv
https://developers.cloudflare.com/pages/platform/functions
https://blog.cloudflare.com/wrangler-v2-beta/
Steps:
Install wrangler 2
var arr = [{"name":"中国大陆","plus":"86"},{"name":"香港地区","plus":"852","afterLength":8,"prefix":"5,6,9"},{"name":"台湾地区","plus":"886","afterLength":9,"prefix":"9"},{"name":"澳门地区","plus":"853","afterLength":8,"prefix":"6"},{"name":"澳大利亚","plus":"61","afterLength":9,"prefix":"4"},{"name":"巴西","plus":"55","afterLength":{"max":11,"min":10}},{"name":"德国","plus":"49","afterLength":{"max":11,"min":10},"prefix":"15,16,17"},{"name":"俄罗斯","plus":"7","afterLength":10,"prefix":"901,902,903,904,905,906,908,909,91,92,93,950,951,952,953,96,98,99"},{"name":"法国","plus":"33","afterLength":9,"prefix":"6,73,74,75,76,77,78"},{"name":"菲律宾","plus":"63","afterLength":10,"prefix":"9"},{"name":"韩国","plus":"82","afterLength":10,"prefix":"1"},{"name":"美国","plus":"1","afterLength":10},{"name":"柬埔寨","plus":"855","afterLength":{"max":10,"min":8},"prefix":"1,38,6,7,8,9"},{"name":"老挝","plus":"856","afterLength":{"max":10,"min":9},"prefix":"20"},{"name":"马来西亚","plus":"60","afterLength":{"max":10,"min":9},"prefix":"1"},{"name":"缅甸","plus":"95","aft
@banyudu
banyudu / auto_publish_npm_and_generate_github_changelog.blog.md
Created April 23, 2020 22:43
自动化发布npm包及生成Github Changelog

手动维护npm包容易出现一些问题:忘记编译、多提交一些无关文件、网络不通等。自动化发布能够极大地简化这个过程。

最近刚调整过一次自动化流程,可以自动发布版本,及根据Commit消息生成Changelog。实现如下图所示的效果:

Demo效果图

@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active June 22, 2024 04:26
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized
@mrpeardotnet
mrpeardotnet / PVE-postinstall-5x.md
Last active March 20, 2024 10:43
PVE-postinstall-6.x

Proxmox PVE 6.x Post Installation Steps

This cheatsheet helps to set up your Proxmox Virtual Environment (PVE) host after fresh installation. Designed and tested on PVE version 6.x.

Note about sudo

I do not prepend sudo command to any of commands listed here, but keep in mind that nearly all commands requires su privileges, so use sudo if your account happen to not have root access.

How to edit config files

The simplest way to edit config file is to use vim.tiny editor, for example to edit vzdump.conf file use this command:

@bcnzer
bcnzer / cloudflareworker-verifyjwt.js
Last active May 20, 2024 18:38
Sample Cloudflare worker that gets the JWT, ensures it hasn't expired, decrypts it and returns a result
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
// Following code is a modified version of that found at https://blog.cloudflare.com/dronedeploy-and-cloudflare-workers/
/**
* Fetch and log a request
* @param {Request} request
*/
@spemer
spemer / customize-scrollbar.css
Last active May 4, 2024 06:37
✨ Customize website's scrollbar like Mac OS. Not supports in Firefox and IE.
/* Customize website's scrollbar like Mac OS
Not supports in Firefox and IE */
/* total width */
body::-webkit-scrollbar {
background-color: #fff;
width: 16px;
}
/* background of the scrollbar except button or resizer */
@deviantony
deviantony / README.md
Last active February 20, 2024 15:22
Portainer HTTP API by example

DEPRECATION NOTICE

This gist is now deprecated in favor of our official documentation: https://documentation.portainer.io/api/api-examples/ which contains up to date examples!

THE FOLLOWING DOCUMENTATION IS DEPRECATED

Please refer to the link above to get access to our updated API documentation and examples.

@alexellis
alexellis / arm.md
Last active May 28, 2024 14:48
Test swarm connectivity

Regular PC / cloud architecture (64-bit)

See the snippets "guide.md" and "redis.md" below.

Swarm on a Raspberry Pi

If you're wanting to run Docker Swarm on your Raspberry Pi checkout these instructions:

@ithinkihaveacat
ithinkihaveacat / service-worker.d.ts
Last active May 1, 2024 01:04 — forked from tiernan/service-worker.d.ts
Typings for using the Service Worker API with TypeScript
/**
* Copyright (c) 2016, Tiernan Cridland
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby
* granted, provided that the above copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR