> npm install random-useragent @types/random-useragent jsdom @types/jsdom node-fetch @types/node-fetch
> tsc --init
> tsc
> node main.js
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
"""Example Linked List Implementation""" | |
from __future__ import annotations | |
from dataclasses import dataclass | |
from typing import Any, Iterable, Optional, Type, TypeVar, Generic, cast | |
import math | |
T = TypeVar("T") |
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
/* | |
A general purpose keyboard/mouse input listener designed for | |
web-based games. | |
Usage: | |
let inputManager = new InputManager(window); | |
let keys = inputManager.pollKeys(); | |
let mouse = inputManager.pollMouse(); |
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
# Assuming ext. drive G: and /mnt/g, respectively | |
sudo mkdir /mnt/g | |
sudo mount -t drvfs G: /mnt/g |
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
/* | |
An over-engineered way to check the max window.localStorage size of your browser. | |
To run the test, past this code into the console of any browser tab. | |
*/ | |
function testStorage(size, progress) { | |
localStorage.clear(); | |
let dummyData = ""; | |
for (let i=0; i<size; i++) { |
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
// very small utility library for doing physics calculations in a js console | |
// designed mostly for my physics homework | |
(function () { | |
window.Cos = function (x) { // degree cosine | |
return Math.cos(x * 0.01745329251); | |
}; | |
window.Sin = function (x) { // degree sine | |
return Math.sin(x * 0.01745329251); | |
}; |
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
const diacritics = []; | |
for (let row = 0; row < 6; row++) { | |
for (let col of "0123456789ABCDEF") { | |
diacritics.push(eval('"\\u03' + row + col + '"')); | |
} | |
} | |
function randomItem(items) { | |
return items[Math.floor(Math.random() * items.length)]; |
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 subprocess import Popen, PIPE, STDOUT | |
from multiprocessing import Process, Queue | |
import queue | |
import os | |
import re | |
from termcolor import colored | |
import argparse | |
import time | |
from datetime import datetime | |
from dataclasses import dataclass |
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 types | |
def switch(x, *args): | |
for c in args: | |
if type(c.val) == types.LambdaType: | |
c.val() | |
if c.should_break: | |
return | |
elif c.matches(x): |
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 requests | |
from dataclasses import dataclass | |
import re | |
import datetime | |
class SchoolType: | |
PUBLIC = 0 | |
URBAN_PUBLIC = 0.4 | |
RURAL_PUBLIC = -0.4 | |
PRIVATE = -0.4 |
NewerOlder