Skip to content

Instantly share code, notes, and snippets.

@meooow25
meooow25 / p01a.js
Last active Jan 1, 2021
Advent of Code 2020
View p01a.js
document.body.textContent.trim().split('\n').map(x => Number(x))
.flatMap((x, i, a) => a.flatMap((y, j) => i < j && x + y === 2020 ? [x * y] : []))
@meooow25
meooow25 / enter.html
Last active Oct 2, 2020
Codeforces login page source on 2020.10.03
View enter.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="X-Csrf-Token" content="29a92b8221e77eed6b9ccc6291788d75"/>
<meta id="viewport" name="viewport" content="width=device-width, initial-scale=0.01"/>
<script type="text/javascript" src="//sta.codeforces.com/s/81126/js/jquery-1.8.3.js"></script>
<script type="application/javascript">
window.standaloneContest = false;
View cf-linemaster.user.js
// ==UserScript==
// @name CF Linemaster
// @namespace https://github.com/meooow25
// @match *://*.codeforces.com/*
// @grant GM.setClipboard
// @version 0.8
// @author meooow
// @description Adds supports for line highlighting and copying on Codeforces
// @downloadURL https://gist.github.com/meooow25/8c91d4b111057f225c1d66e46cf00de2/raw/cf-linemaster.user.js
// ==/UserScript==
@meooow25
meooow25 / solved.py
Last active Oct 25, 2019
Solved plot for duck
View solved.py
import argparse
import json
import urllib.request
from matplotlib import pyplot as plt
STATUS_URL_FMT = 'https://codeforces.com/api/user.status?handle={}'
CONTESTS_URL = 'https://codeforces.com/api/contest.list'
DEFAULT_LO, DEFAULT_HI = 500, 3800
STEP = 100
FIGSIZE = (12, 6)
View passcheck.py
"""
Checks if a password is pwned using the https://haveibeenpwned.com/ API
Usage: python passcheck.py password
"""
import argparse
import hashlib
import urllib.request
URL = 'https://api.pwnedpasswords.com/range/'
@meooow25
meooow25 / fast_input.py
Last active Nov 12, 2018
Super fast input for Python. Can be made faster by sacrificing ease of use and accessing the tokens directly instead of using the ns, nf, ni functions.
View fast_input.py
def init_input():
import os
from sys import stdin
it = iter(os.read(stdin.fileno(), 10 ** 9).split())
return lambda: next(it).decode(), lambda: int(next(it)), lambda: float(next(it))
ns, ni, nf = init_input()
some_string = ns()
some_int = ni()
some_float = nf()