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 std::env; | |
use std::fs::File; | |
use std::io::{BufRead, BufReader, BufWriter, Write}; | |
use std::path::Path; | |
use regex::Regex; | |
use chrono::{FixedOffset}; | |
const HOUR: u32 = 3600; | |
fn parse_offset(raw_offset: &str) -> i32 { |
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
adject = ['adult human', 'AFAB', 'alpha', 'AMAB', 'anime', 'biological', 'butch', 'cisgender', 'ex', 'failed', 'female', 'FtM', 'gamer', 'gay', 'gender neutral', 'it/its', 'male', 'MtF', 'neurodivergent', 'normal', 'non-binary', 'pathetic', 'punished', 'sigma', 'they/them', 'transgender', 'transsexual'] | |
prefix = [ 'a', 'allo', 'andro', 'bi', 'boy', 'cat', 'cis', 'demi', 'dog', 'doll', 'fem', 'fluid', 'gender', 'girl', 'grey-a', 'guy', 'hetero', 'homo', 'him', 'inter', 'intra', 'les', 'lesbo', 'male', 'man', 'masc', 'macro', 'meta', 'micro', 'neo', 'neutro', 'non', 'nu', 'pan', 'poly', 'post', 'pre', 'she', 't', 'tom', 'trans', 'them', 'tri', 'x-', 'xirl']; | |
suffix = ['bian', 'binary', 'bo', 'boi', 'boy', 'butch', 'bxy', 'by', 'cat', 'dog', 'doll', 'fem', 'femme', 'friend', 'flux', 'fucky', 'gal', 'gender', 'girl', 'guy', 'gxrl', 'gyne', 'husband', 'lesbian', 'masc', 'male', 'man', 'moder', 'queer', 'sex', 'vir', 'wife', 'witch', 'woman', 'xirl']; | |
flags = { | |
nonbinary: ['#fcf434', '#fcfcfc', '#9c59d1', '#2c2 |
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 | |
def get_start_of_week(value: datetime) -> datetime: | |
"""Returns the datetime of the start of the week for the given datetime.""" | |
return (value - timedelta(days=value.weekday())).replace(hour=0, minute=0, second=0, microsecond=0) | |
def get_minutes_since_start_of_week(value: datetime) -> float: | |
"""Returns the number of minutes since the start of the week.""" |
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
Show hidden characters
{ | |
"compilerOptions": { | |
"target": "es2020", | |
"lib": [ | |
"dom", | |
"dom.iterable", | |
"esnext" | |
], | |
"allowJs": true, | |
"skipLibCheck": true, |
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 asyncio | |
import io | |
import os | |
from typing import Optional | |
import websockets | |
from PIL import Image | |
from constants import Environment |
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
-- Find all threads that have zero subscriptions BUT have at least one attachment | |
SELECT * | |
FROM (SELECT "Thread".id, "Thread".subject, | |
COUNT(DISTINCT(S."threadId")) AS Subscriptions, | |
COUNT(A.id) AS Attachments | |
FROM "Thread" | |
LEFT JOIN "Post" P on "Thread".id = P."threadId" | |
LEFT JOIN "Attachment" A on P.id = A."postId" | |
LEFT JOIN "Subscription" S on "Thread".id = S."threadId" | |
GROUP BY "Thread".id) |
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 const union = <T>(a: Set<T>, b: Set<T>) => new Set([...a, ...b]); | |
export const intersection = <T>(a: Set<T>, b: Set<T>) => new Set([...a].filter(x => b.has(x))); | |
export const difference = <T>(a: Set<T>, b: Set<T>) => new Set([...a].filter(x => !b.has(x))); | |
export const symmetric = <T>(a: Set<T>, b: Set<T>) => union(difference(a, b), difference(b, a)); | |
export const isSubsetOf = <T>(a: Set<T>, b: Set<T>) => [...b].every(x => a.has(x)); | |
export const isSupersetOf = <T>(a: Set<T>, b: Set<T>) => [...a].every(x => b.has(x)); | |
export const isDisjointFrom = <T>(a: Set<T>, b: Set<T>) => !intersection(a, b).size; |
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
/* | |
The router query parameters are not immediately made available on first render. | |
Here I use a reference to track when the router's query parameter were first made available. | |
A reference is used instead of state to ensure no unnecessary re-renders are made. | |
*/ | |
const routerExecutionRef = useRef(false); | |
useEffect(() => { | |
if (router.isReady && !routerExecutionRef.current) { | |
routerExecutionRef.current = true; |
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 React from "react"; | |
import { Button } from "@chakra-ui/react"; | |
import ReactDOMServer from "react-dom/server"; | |
interface DipswitchProps { | |
length: number; | |
value: number; | |
} | |
interface DipswitchExporterProps { |
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 { z } from "zod"; | |
import { getMonth } from "date-fns"; | |
export const SeasonEnum = z.enum(["FALL", "SPRING"]); | |
export type Season = z.TypeOf<typeof SeasonEnum>; | |
export const SemesterSchema = z.object({ | |
season: SeasonEnum, | |
year: z.number().min(2000).max(2050), | |
}); |