Skip to content

Instantly share code, notes, and snippets.

View iamevn's full-sized avatar

Evan Minsk iamevn

View GitHub Profile
@iamevn
iamevn / cdromance-download-links.user.js
Last active May 3, 2024 21:02
simple userscript to insert download links back into cdromance (you might need to refresh the page if the links break) (click raw link near top right to install)
#!/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:
@iamevn
iamevn / plex.nix
Last active February 15, 2022 00:22
my NixOS Plex module (with a PlexPass overlay)
{ pkgs, ... }:
### Plex Media server
# Uses plexpass version if plexpass.json exists
let
plexpass-overlay = import ./plexpass-overlay.nix;
in {
# Plex is unfree, allow it anyways
imports = [ ./allowed_unfree.nix ];
allowedUnfreePkgs = [ "plexmediaserver" ];
#!/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)
import re
import webbrowser
from tweet import gen_tweet
from tweepy_api import get_api
def last_rt(user, tweet_id):
api = get_api()
timeline = api.user_timeline(user, max_id=tweet_id, count=100)
@iamevn
iamevn / scaled_canvas_window.py
Created August 25, 2020 00:20
simple tk canvas to play around with
#/usr/bin/env python3
import tkinter as tk
import random
import threading
from wrapt import synchronized
from typing import Callable, Sequence, Union
class ScaledCanvasWindow:
'''
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def generate_ranges(lower, upper, count, pre=None):
if pre is None:
pre = []
if count > 1:
for i in range(lower, upper):
yield from generate_ranges(lower, upper, count - 1, pre + [i])
elif count == 1:
for i in range(lower, upper):
yield pre + [i]
else:
javascript:var coding = "abcdefghijklmnopqrstuvwxyzabcdefghijklmABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM"; function rot13(t) { for (var r = "",i=0;i<t.length;i++) { character = t.charAt(i); position = coding.indexOf(character); if (position > -1) character = coding.charAt(position + 13); r += character; } return r; } S=window.getSelection(); function t(N) { return N.nodeType == N.TEXT_NODE; } function r(N) { if (t(N)) N.data = rot13(N.data); } for (j=0;j<S.rangeCount;++j) { var g=S.getRangeAt(j), e=g.startContainer, f=g.endContainer, E=g.startOffset, F=g.endOffset, m=(e==f); if(!m||!t(e)) { /* rot13 each text node between e and f, not including e and f. */ q=document.createTreeWalker(g.commonAncestorContainer, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT, null, false); q.currentNode=e; for(N=q.nextNode(); N && N != f; N = q.nextNode()) r(N); } if (t(f)) f.splitText(F); if (!m) r(f); if (t(e)) { r(k=e.splitText(E)); if(m)f=k; e=k;} if (t(f)) g.setEnd(f,f.data.length); } void 0
@iamevn
iamevn / readme.txt
Created April 28, 2020 05:09
Puzzlescript Chess (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html