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
// ==UserScript== | |
// @name New Userscript | |
// @namespace http://tampermonkey.net/ | |
// @version 2024-08-06 | |
// @description try to take over the world! | |
// @author You | |
// @match https://www.twitch.tv/videos/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitch.tv | |
// @grant none | |
// ==/UserScript== |
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
'use strict' | |
const { pathToFileURL } = require('node:url') | |
// node_modules/lambda-runtime/dist/node16/UserFunction.js | |
;(function () { | |
const __getOwnPropNames = Object.getOwnPropertyNames | |
const __commonJS = (cb, mod) => | |
function __require() { | |
return ( |
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 time | |
from twilio.rest import Client | |
import requests | |
from dateutil import parser | |
# Create client | |
account_sid = '' # TODO: Grab from Twilio | |
auth_token = '' # TODO: Grab from Twilio | |
client = Client(account_sid, auth_token) |
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
from scipy import ndimage | |
import numpy as np | |
from PIL import Image | |
from random import randint | |
from copy import deepcopy | |
# set the file path to wherever your provinces.png is located | |
im = Image.open(r"colors.png") | |
print('-------------------------------------------') | |
# DEBUGGING: simply prints the format, size, and mode of your file |
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 itertools as it | |
""" | |
Given a start/end IP, return all IPs in that range (inclusive) | |
""" | |
def ipRange(start_ip: str, end_ip: str): | |
start = [int(x) for x in start_ip.split('.')] | |
end = [int(x) for x in end_ip.split('.')] | |
yield start_ip |
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
// x^p mod m | |
function powerMod(x: number, p: number, m: number): number { | |
if (m === 1) { | |
return 0; | |
} | |
x = x % m; | |
let result = 1; | |
while (p > 0) { | |
if (p % 2 === 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
export interface ReplacerArgs { | |
match: string; // the matched substring | |
groups: string[]; // captured groups | |
offset: number; // offset of match | |
string: string; // entire string | |
named_groups?: Record<string, string>; // named capturing groups | |
} | |
function parseReplacerArgsMutating(args: [string, ...any[]]): ReplacerArgs { | |
const named_groups = typeof args[args.length - 1] === 'object' ? (args.pop() as Record<string, string>) : undefined; |
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
function isStringEnum<T extends Record<string, string | number>>(t: T): boolean { | |
return typeof Object.values(t).pop() === 'string'; | |
} | |
export function enumKeys<T extends Record<string, string | number>>(t: T): (keyof T)[] { | |
return isStringEnum(t) ? Object.keys(t) : Object.keys(t).slice(0, Object.keys(t).length / 2); | |
} | |
export function enumValues<T extends Record<string, string>>(t: T): string[]; | |
export function enumValues<T extends Record<string, string | number>>(t: T): 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
// Function to load a JS file | |
async function loadScript(url) { | |
return await new Promise((resolve, reject) => { | |
const script = document.createElement('script'); | |
script.src = url; | |
script.addEventListener('load', () => resolve()); | |
script.addEventListener('error', () => reject()); | |
document.body.appendChild(script); | |
}); | |
} |
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
from PySide2.QtCore import QObject, QTimer | |
from PySide2.QtWidgets import QApplication, QDialog | |
import sys | |
class Form(QDialog): | |
def __init__(self, parent=None): | |
super(Form, self).__init__(parent) | |
self.setWindowTitle("My Form") | |
self.setStyleSheet(""" |
NewerOlder