Skip to content

Instantly share code, notes, and snippets.

View Orenoid's full-sized avatar

Orenoid

View GitHub Profile
{
"relations": [
{
"id": 24,
"role": "admin",
"edges": {
"Org": null,
"User": {
"id": 1,
"name": "abc",
@Orenoid
Orenoid / cache.py
Created April 22, 2020 07:17
LRU Cache
class Node:
def __init__(self, key=None, value=None, prev=None, next=None):
self.key = key
self.value = value
self.prev = prev
self.next = next
def leave(self):
prev, next = self.prev, self.next
assert isinstance(prev, Node)
@Orenoid
Orenoid / cache.py
Last active July 1, 2022 19:55
Python lru_cache with expiration
import datetime
import time
from _thread import RLock
from functools import update_wrapper, _make_key, _CacheInfo
# Check the example at the end of this script.
class Node:
"""node of the circular doubly linked list"""
@Orenoid
Orenoid / steam_queue.js
Created December 22, 2019 11:26
steam探索队列
(function _exec(){
var appids,
running = true,
queueNumber,
progressDialog = ShowAlertDialog('探索中', $J('<div/>').append($J('<div/>', {'class': 'waiting_dialog_throbber'}) ).append( $J('<div/>', {'id': 'progressContainer'}).text('获取进度...') ), '停止').done(abort);
function abort(){
running = false;
progressDialog.Dismiss();
}
function retry(){
@Orenoid
Orenoid / titles.json
Created October 28, 2019 09:40
轻小说标题列表
[
"为所欲为的前勇者再度转生,开始强大而愉快的第二轮游戏(不自重前勇者强大又轻松的NEW GAME)",
"结束时在做什么呢?正忙着吗?被拯救可以吗?(末日时在做什么?有没有空?可以来拯救吗?)",
"死神外传小说(BLEACH Spirits Are Forever With You)",
"普通攻击是全体二连击,这样的妈妈你喜欢吗?(平A=两次全体攻击的老妈你喜欢吗?)",
"身为男高中生兼当红轻小说作家的我,正被年纪比我小且从事声优工作的女同学掐住脖子",
"加入年轻人敬而远之的黑魔法公司,没想到工作待遇好,社长和使魔也超可爱,太棒了!",
"为了拯救世界的那一天─Qualidea Code─(为了终有一天能拯救世界)",
"转生成女性向游戏里尽是毁灭FLAG的反派千金了(转生恶役只好拔除破灭旗标)",
"喜欢上亲友的女友的向井弘凪的罪与罚(喜欢上死党的女友,向井弘凪的罪与罚)",
@Orenoid
Orenoid / test.go
Created July 18, 2019 05:07
go code
package main
import "fmt"
import "time"
import "runtime"
func counter(name string){
for n:=0;n<20;{
n++
@Orenoid
Orenoid / double_stack_sort.py
Last active July 4, 2019 10:07
算法与数据结构
from collections import deque
import random
import pysnooper
# @pysnooper.snoop()
def sort(stack):
help = deque()
while len(stack) != 0:
tmp = stack.pop()
while len(help)>0 and help[-1] > tmp: