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
#┊ ⚠ Overwrite input() function to take inputs from a list ⚠ | |
#╰╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ | |
_i, _, _P, input = [], lambda v: _i.append(v.splitlines()[1::]), lambda p: print(p, end="") if p else None, lambda p=None: _i[0].pop(0) if _P(p) is None else _i[0].pop(0) | |
#┌────────────────────────── | |
#│ ✔ INPUT LINES GO HERE ✔ | |
#└────────────────────────── | |
_(''' | |
3 | |
SOFI | |
AMZN |
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 | |
def rate_limit(sec: float = 0): | |
"""Rate limit a function by number of seconds between calls. | |
Rate is time passage aware so if the last call was over the limiter, then the next call will be immediate. | |
Additionally if the time past since the last call was half the time limit, then the next call will be delayed | |
by half the time limit. | |
### Examples: |
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 functools | |
def staticinator(**kwargs): | |
""" Dr. Heinz Doofenshmirtz Approved Staticinator | |
Ah, Perry the Plateaus, you're just in time to witness my latest invention, the Staticinator! | |
It's a device that makes things static! Behold! | |
Allow me to explain my evil plan. |
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
#!/bin/sh | |
# dnsexit.sh - A DnsExit.com DDNS custom module for Synology DSM | |
# | |
# Author: | |
# Brian Schmidt Pedersen (http://blog.briped.net) | |
# Zinthose (https fork/edit) | |
# | |
# Version: | |
# 1.3.5 |
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 inspect | |
import re | |
def static(variable_or_default: any) -> any: | |
""" | |
An over engineered static variable solution | |
This method allows you to define static variables in a function. This is | |
useful for when you want to save a value for later use in the same function. | |
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 typing import Callable | |
def purgeValues(value: dict | list, preserve_list_structure: bool = False, purgeTest: Callable[[any], any] = lambda x: x is None or (type(x) is str and len(x) == 0) or (type(x) is list and len(x) == 0)): | |
"""Purge values from a dictionary or list. | |
-------------------- | |
Recursively remove all matching purgeTest values from dictionaries and lists, and returns | |
the result as a new dictionary or list. | |
By default this will remove all `None`, empty string values, and empty lists. | |
If the `preserve_list_structure` argument is set to True, then empty lists will not be |
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
/** | |
* Simple object that requires each keyed value to be a string. | |
*/ | |
interface StringObject {[key: string]: string;} | |
/** | |
* Utility function to create a URL with parameters. | |
* @param url Base URL to build for. | |
* @param uri_values URI parameters to encode add to URL |
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 datetime import datetime, timedelta | |
import holidays | |
def nextBusinessDay(today=None, additional_offset=0, skip_holidays = True, format=r"%m/%d/%Y", holiday_settings = {'country':'US'}): | |
# pip install holidays | |
h_days = holidays.CountryHoliday(**holiday_settings) | |
# Get todays date if not initially set | |
if today==None: | |
today = datetime.now().date() |
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 Get RedText | |
// @namespace https://gist.github.com/0xFireball/0b0673fd7801de9f82278725d1250cbb | |
// @version 0.3 | |
// @description Get's the text text from the WebAssign assignment pages and places them into the clipboard tab delimited. This is good for pasting values directly into excel. | |
// @author Dane Jones | |
// @require https://code.jquery.com/jquery-2.1.4.min.js | |
// @require https://raw.githubusercontent.com/kamranahmedse/jquery-toast-plugin/bd761d335919369ed5a27d1899e306df81de44b8/dist/jquery.toast.min.js | |
// @match https://www.webassign.net/web/* | |
// @icon https://www.google.com/s2/favicons?domain=webassign.net |
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 this one for pasting into a single column | |
copy(Array.from(document.querySelectorAll("div.qws.initialized.focused font[color=red]")).map(e=>e.textContent).join("\n")); | |
// Use this one for pasting into a single row | |
copy(Array.from(document.querySelectorAll("div.qws.initialized.focused font[color=red]")).map(e=>e.textContent).join("\t")); | |
// OTHER: I've used this for wierd outliers but the output data is kinda suspect. | |
copy([...[...document.querySelectorAll('div.qws.initialized.focused *')].filter(el => (el.childElementCount === 0 && el.innerText !== "" && getComputedStyle(el).color === 'rgb(181, 33, 32)'))].map(e=>e.textContent).join("\n")); |
NewerOlder