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
#include <functional> | |
#include <typeinfo> | |
#include <type_traits> | |
namespace std17 | |
{ | |
class bad_any_cast : public std::bad_cast | |
{ | |
public: | |
bad_any_cast() noexcept = default; |
This file has been truncated, but you can view the full 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
{ | |
"id": "UUK3kaNXbB57CLcyhtccV_yw", | |
"videos": { | |
"t9OC2ToZIQ0": { | |
"id": "t9OC2ToZIQ0", | |
"title": "Yearly Channel Doctor's Appointment", | |
"description": "You thought I ran out of Spider-Man games? \n\n2nd Channel\nhttps://www.youtube.com/channel/UCL7DDQWP6x7wy0O6L5ZIgxg\n\nTwitch\nhttp://www.twitch.tv/jerma985\n\nTwitter\nhttp://www.twitter.com/jerma985", | |
"thumbnail": "https://i.ytimg.com/vi/t9OC2ToZIQ0/hqdefault.jpg?sqp=-oaymwEZCNACELwBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLBqzhvyJZO0NP_N8-7VJ-UNBWyjFQ", | |
"date": "20170829", | |
"duration": 554 |
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 class instead of QThread | |
class QThread2(QThread): | |
# Use this signal instead of "started" | |
started2 = Signal() | |
def __init__(self): | |
QThread.__init__(self) | |
self.started.connect(self.onStarted) | |
def onStarted(self): |
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(""" |
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
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
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
// 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
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
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 |