Skip to content

Instantly share code, notes, and snippets.

@jiangzhuo
jiangzhuo / comparision.md
Last active March 20, 2023 09:13
AWS managed service from Open Source?
AWS OpenSource
OpenSearch ElasticSearch
Athena Presto
Redshift PostgreSQL
MSK Kafka
Kinesis Data Analytics Flink
DocumentDB MongoDB
Keyspaces Cassandra
Elastic Transcoder ffmpeg

Volunteer deployment

There are n venues (starting from 0), and the distribution of roads between venues is recorded in a two-dimensional array edges, edges[i]= [x, y] means that the i-th road connects venue x and venue y (i.e., two venues are adjacent to each other). Initially, each venue has a certain number of volunteers (the number of volunteers may vary from venue to venue), and the number of volunteers will be deployed every day for the next m days according to the popularity of the event. There are three deployment options:

  1. Halve the number of volunteers in the venue with idx number.
    cnt[idx] = cnt[idx]/2;
  2. Adding the number of volunteers from the venue with idx to the number of volunteers from the venue with idx in the adjacent venues. cnt[idx-1] += cnt[idx]; cnt[idx+1] += cnt[idx];
  3. Subtracting the number of volunteers in the venue numbered idx from the number of volunteers in the venue numbered idx from the number of volunteers in the venue adjacent to the venue numb
@jiangzhuo
jiangzhuo / How do I ask a good question.md
Created March 30, 2022 22:21
How do I ask a good question

How do I ask a good question?

The debug process is actually the process of constantly asking and answering questions to a rubber duck (yourself)

Before asking someone else

How do I ask a good question? - Help Center

Search and Research

@jiangzhuo
jiangzhuo / manifest
Last active December 22, 2021 06:18
{
"enabled" : true,
"services": [
{
"id": "tiles",
"name": "OpenSearch Maps Tile Service",
"manifest": "https://maps.opensearch.org/tiles/v2.json",
"type": "tms"
},
{
@jiangzhuo
jiangzhuo / bahamut.ini
Last active May 4, 2022 18:29
router-remote-config
USER-AGENT,Anime*
PROCESS-NAME,tw.com.gamer.android.animad
DOMAIN-SUFFIX,bahamut.com.tw
DOMAIN-SUFFIX,gamer.com.tw
DOMAIN-SUFFIX,hinet.net
DOMAIN-SUFFIX,hanime1.me
IP-CIDR,104.16.181.30/32,no-resolve
IP-CIDR,104.26.0.18/32,no-resolve
@jiangzhuo
jiangzhuo / stalker.js
Created August 18, 2019 11:12
discord stalker plugin
//META{"name":"Stalker"}*//
// !!! Hey there! If you didn't come here from the BetterDiscord Discord server ( https://discord.gg/2HScm8j ) !!! //
// !!! then please do not use whatever you were using that led you here, getting plugins from places other than !!! //
// !!! the #plugin repo channel in the BD server can be dangerous, as they can be malicious and do bad things. !!! //
class Stalker {
getName() {
return "Stalker";
}
function parseFile (req, res) {
req.setEncoding('binary');
var body = ''; // 文件数据
var fileName = ''; // 文件名
// 边界字符串
var boundary = req.headers['content-type'].split('; ')[1].replace('boundary=','');
req.on('data', function(chunk){
body += chunk;
});
@jiangzhuo
jiangzhuo / a.js
Last active March 21, 2019 09:35
自动设置所有自己的微博为自己可见,在自己的https://weibo.com/p/*********页面打开浏览器Console运行以下代码
let count = 0;
window.setInterval(function(){
if($('a[action-type="ok"]')[0]){
$('a[action-type="ok"]')[0].click()
}
$('a[action-type="fl_menu"]')[0].click();
if($('a[action-type="ok"]')[0]){
$('a[action-type="ok"]')[0].click()
}
if($('a[action-type="fl_personalVisible"]')[0]===undefined){
function FindProxyForURL(url, host) {
return "SOCKS5 127.0.0.1:1090";
}
const EOL = require('os').EOL;
const reCommentContents = /\/\*([\s\S]*?)\*\//;
// Node wraps modules in a function so we can't use the native .isToplevel() method
const reTopLevel = /function \(exports, require/;
const multiline = () => {
const _ = Error.prepareStackTrace;
Error.prepareStackTrace = (_, stack) => stack;