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 | |
# Do Riichi final scoring based on | |
# http://arcturus.su/wiki/Oka_and_uma | |
def placements(scores): | |
"""return array of relative placements in scores. | |
0 for the best score 1 for second best, etc. | |
ties broken by order in scores |
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 | |
from sys import argv, exit | |
from os import path, remove, scandir, rename | |
try: | |
from bencodepy import decode_from_file | |
except ImportError: | |
exit('bencodepy is not installed.\n(hint: pip install bencodepy)') | |
if len(argv) < 2: |
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 | |
import os | |
from os import path | |
options = {debug:True, | |
doit :True} | |
def restructure(basepath): | |
"""given a basepath, restructure each folder within basepath. | |
equilivant to the following lines of bash where out is basepath: |
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/node | |
const PlexAPI = require('plex-api'); | |
const credentials = require('plex-api-credentials'); | |
const userAndPass = credentials({ | |
username: 'username', | |
password: 'hunter2' | |
}); | |
const client = new PlexAPI({ | |
hostname: 'localhost', |
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 sys | |
def replace_text(inpath, outpath, replacements): | |
with open(outpath, 'w', encoding='utf-8') as outfile: | |
for line in open(inpath, encoding='utf-8'): | |
for key in replacements: | |
val = replacements[key] | |
line = line.replace('\\an{}'.format(key), '\\an{}'.format(val)) | |
outfile.write(line) |
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 | |
# split out AMAZON/NETFLIX STYLE TYPESETTING | |
#by iamevn | |
import sys, re | |
def find_nth(string, substring, n, start=0): | |
"""find nth occurance of substring in string starting at position start. | |
(uses string.find) n starts at 1, start starts at 0""" | |
found = string.find(substring, start) | |
if n == 1 or found == -1: |
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
# Any live cell with fewer than two live neighbours dies, as if caused by underpopulation. | |
# Any live cell with two or three live neighbours lives on to the next generation. | |
# Any live cell with more than three live neighbours dies, as if by overpopulation. | |
# Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction. | |
# width and height define the world, it wraps around like a torus | |
# clear screen by outputting \033c (27 99) | |
# (0, 0) (top left) is in cell 0. (0, 1) is in cell 1. (1, 0) is in cell {width} | |
# for a cell n in grid of width w and height h, its neighbors are: | |
# {(n - w - 1), (n - w), (n - w + 1) |
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 | |
# combine adjacent lines with the same timecodes | |
import sys | |
from datetime import datetime, timedelta | |
def find_nth(string, substring, n, start=0): | |
"""find nth occurance of substring in string starting at position start. | |
(uses string.find) n starts at 1, start starts at 0""" | |
found = string.find(substring, start) |
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 | |
from sys import argv, exit | |
from os import walk,path | |
try: | |
from bencodepy import decode_from_file | |
except ImportError: | |
exit("bencodepy is not installed. ") | |
if len(argv) < 2: |
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
script_name="Shift Transforms" | |
script_description="shift \\t transforms by input ms" | |
script_author="iamevn" | |
script_version="0.2" | |
script_namespace="evn.ShiftTransforms" | |
--[[ | |
Usage: | |
selected lines should have a transform on them |