This file contains hidden or 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 | |
# Collect a mapping of style -> appearances | |
appearances = {} | |
for i in range(1, 51): | |
with open(f'[Treebeard] Kemono no Souja Erin BD - {i:02}.ass', 'r') as f: | |
for line in f: | |
if line.startswith('Style:'): | |
line = line.strip() # Get rid of stray newlines | |
line = line[7:] # And the Style: prefix |
This file contains hidden or 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
# Sample output of 'mkvmerge -i file.mkv' | |
# | |
# File 'file.mkv': container: Matroska | |
# Track ID 0: video (MPEG-4p10/AVC/h.264) | |
# Track ID 1: audio (AAC) | |
# Track ID 2: subtitles (SubStationAlpha) | |
# Attachment ID 1: type 'application/x-truetype-font', size 53532 bytes, file name 'some_font.ttf' | |
# Chapters: 7 entries | |
function __fish_mkvextract_get_mode |
This file contains hidden or 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
# This code is a wrapper for the API exposed by the deluge-webapi plugin. | |
# https://github.com/idlesign/deluge-webapi | |
import subprocess | |
import requests as http | |
import json | |
from dataclasses import dataclass | |
# replace as necessary with values appropriate for your use case | |
endpoint = 'https://deluge.example.com/json' |
This file contains hidden or 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 requests as http | |
import feedparser as rss | |
import time | |
from dataclasses import dataclass | |
# replace as necessary with a module appropriate for your use case | |
import deluge | |
# not the one on PyPI, something much simpler: | |
# class AD(dict): def __init__(s, *a, **k): super(AD, s).__init__(*a, **k); s.__dict__ = s | |
# credit to natevw on StackOverflow: https://stackoverflow.com/a/14620633 |
This file contains hidden or 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 vapoursynth as vs | |
#class vs: | |
# VideoNode = list | |
from enum import Enum, auto | |
from typing import Callable, Sequence, Union | |
from dataclasses import dataclass | |
class SegType(Enum): |
This file contains hidden or 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
-- Copyright (c) 2020, The0x539 <[email protected]> | |
-- | |
-- Permission to use, copy, modify, and 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 |
This file contains hidden or 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
local function XYZfromRGB(r, g, b) | |
r, g, b = r/0xFF, g/0xFF, b/0xFF | |
local function f(n) | |
if n > 0.04045 then | |
return math.pow(((n + 0.055) / 1.055), 2.4) | |
else | |
return n / 12.92 | |
end | |
end |
This file contains hidden or 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
// ==UserScript== | |
// @name Nyaa: filter out garbage | |
// @namespace Violentmonkey Scripts | |
// @match https://nyaa.si/ | |
// @grant none | |
// ==/UserScript== | |
let blockedTags = [ | |
'JAM_CLUB', | |
'StreamAnime', |
This file contains hidden or 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
split_list = lambda x: (x[:len(x) // 2], x[len(x) // 2:]) | |
def merge_lists(x, y): | |
merged = [] | |
while len(x) > 0 and len(y) > 0: | |
if x[0] <= y[0]: | |
merged.append(x[0]) | |
x = x[1:] | |
else: | |
merged.append(y[0]) |
This file contains hidden or 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
#include <stdlib.h> | |
#include <string.h> | |
typedef unsigned int uint; | |
static void split_array(void *array[], uint len, void ***left, uint *llen, void ***right, uint *rlen) { | |
*llen = *rlen = len / 2; | |
if (*llen + *rlen < len) { | |
*llen = *llen + 1; | |
} | |
size_t lsize = *llen * sizeof (void *); |