This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface PaginationArgs { | |
cursorName?: string; | |
cursor?: number; | |
forward?: number; | |
backward?: number; | |
skipPage?: number; | |
} | |
export const loadNewPageArgs = ( | |
totalPage: number, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pagination.input.ts | |
import { Field, InputType } from '@nestjs/graphql'; | |
import { IsInt, IsOptional, Max, Min } from 'class-validator'; | |
@InputType() | |
export class PaginationInput { | |
// cursor field name | |
@Field({ nullable: true }) | |
@IsOptional() | |
cursorName?: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const events = ['mousedown', 'mousemove', 'keypress', 'scroll', 'touchstart']; | |
// tick timer for schedule jobs | |
// idle timer autoremove it self after stop | |
export class IdleTickTimer { | |
private idleCount: number = 0; | |
private stopIdleCount: number = 0; | |
private idleTickCallback: { (tick: number, final: boolean): void }; | |
private intervalID: number; | |
private activityCallback: { (): void } | null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { pbkdf2, randomBytes } from 'crypto'; | |
import { promisify } from 'util'; | |
export interface PBKDF2Options { | |
digest: string; | |
iterations: number; | |
keylen?: number; | |
} | |
export class PBKDF2 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
batch change tracker for qbittorrent 4.2- | |
''' | |
import sys | |
import os | |
import glob | |
import bencode | |
if __name__ == '__main__': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
#First released as C++ program by Hiroyuki Tsutsumi as part of the free software suite “Beer” | |
#I thought porting it to Python could be both a challenge and useful | |
from sys import argv, exit, getsizeof | |
from struct import pack_into, unpack_from | |
def ceil4(n): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import asyncio | |
import aiohttp | |
class Server: | |
def __init__(self, ws_uri, loop=None, **wskwargs): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import asyncio | |
from aiohttp import web | |
class Server: | |
def __init__(self, host, port, loop=None, **kwargs): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import glob | |
def parse_block(f, info): | |
block = {} | |
line = f.readline().strip() | |
if not line: | |
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*-: coding: utf-8 -*- | |
import asyncio | |
import aiohttp | |
import traceback | |
import datetime | |
import math | |
def hsize(s): | |
suffixs = ["B", "KB", "MB", "GB"] |
NewerOlder