Skip to content

Instantly share code, notes, and snippets.

View nekomeowww's full-sized avatar
🥰
Gaining sunshine

Neko nekomeowww

🥰
Gaining sunshine
View GitHub Profile
@nekomeowww
nekomeowww / twitch_day_theme.css
Last active December 10, 2023 09:48
Twitch Chatbox in OBS
/*
Twitch chat browsersource CSS for OBS
Just set the URL as https://www.twitch.tv/popout/%%TWITCHCHANNEL%%/chat
And paste this entire file into the CSS box
Original by twitch.tv/starvingpoet modified by github.com/Bluscream
Readjusted for new (2019/2020) Twitch by github.com/mjbogusz
General Settings
*/
body {
color: #000000 !important;
@nekomeowww
nekomeowww / rate_limit.go
Last active April 21, 2022 09:55
限流中间件
package middleware
type responseBuffer struct {
gin.ResponseWriter // the actual ResponseWriter to flush to
Body *bytes.Buffer // the response content body
Flushed bool
}
func (w *responseBuffer) Write(b []byte) (int, error) {
return w.Body.Write(b)
@nekomeowww
nekomeowww / 1_synced_timer.js
Last active January 4, 2022 08:28
支持管理和同步系统时间的计时器实现
window.globalScope = {
syncedTimer: {
/**
* 计时器对象,保存了所有计时器的 id 和运行、重设状态
*
* @example { main : { "1": { running: true, reset: false }, "2": { running: false, reset: true } } }
*/
mTimers: {
main: {}
},
@nekomeowww
nekomeowww / mongodb_query.js
Created November 26, 2021 02:23
MongoDB millisecond UNIX timestamp
((new Date().getTime()/1000)-(new Date().getTime()/1000%1))
@nekomeowww
nekomeowww / mongodb_facet_and_unwind.md
Last active November 6, 2023 10:29
Count multiple fields in MongoDB aggregation

Summary

Let's say we have the following documents:

[
  {"_id": "6094de60f74b0354af32dd17", "id": 1, "title": "Title1", "status": 1, "nested_field": {"expire_time": 4130633413} }
  {"_id": "6094de60f74b0354af32dd18", "id": 1, "title": "Title1", "status": 1}
  {"_id": "6094de60f74b0354af32dd19", "id": 2, "title": "Title2", "status": 0}
  {"_id": "6094de60f74b0354af32dd20", "id": 2, "title": "Title2", "status": 2}
package util
import "reflect"
// UniqAny 去重
func UniqAny(arrs interface{}) interface{} {
value := reflect.ValueOf(arrs)
// input value must be a slice
if value.Kind() != reflect.Slice {
@nekomeowww
nekomeowww / arweaveTransactionOwnerToAddress.js
Last active April 2, 2021 09:55
Arweave Owner to Address
import Arweave from 'arweave'
const arweave = Arweave.init({
host: 'arweave.net',
port: 443,
protocol: 'https',
timeout: 20000,
logging: false
})
@nekomeowww
nekomeowww / arclightTxsGraphql.js
Created February 9, 2021 14:23
ArcLight Txs GraphQL
const { gql, request } = require("graphql-request")
const query = gql`
{
transactions(
tags: [
{ name: "App-Name", values: "arclight-app" }
{ name: "Type", values: "Purchase" }
],
first: 100
/**
* @param {string} word1
* @param {string} word2
* @return {number}
*/
let minDistance = function(word1, word2) {
let wordArr1 = word1.split("")
let wordArr2 = word2.split("")
let count = 0
@nekomeowww
nekomeowww / keybase.md
Created March 3, 2018 03:33
keybase.md

Keybase proof

I hereby claim:

  • I am nekomeowww on github.
  • I am ayakaneko (https://keybase.io/ayakaneko) on keybase.
  • I have a public key ASDgV2GVjKaEVf9KZPbl79unvUhuERWfYPr6qc0QetSYywo

To claim this, I am signing this object: