This file contains hidden or 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 argparse | |
| from typing import Sequence, MutableSequence | |
| _rule30 = { | |
| (True, True, True): False, | |
| (True, True, False): False, | |
| (True, False, True): False, | |
| (True, False, False): True, | |
| (False, True, True): True, | |
| (False, True, False): True, |
This file contains hidden or 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 getpass | |
| import hashlib | |
| bytes_to_bits = lambda bs: ''.join('1' if bs[i//8] & (128 >> (i % 8)) else '0' for i in range(len(bs)*8)) | |
| bip39_wordlist = 'abandon ability able about above absent absorb abstract absurd abuse access accident account accuse achieve acid acoustic acquire across act action actor actress actual adapt add addict address adjust admit adult advance advice aerobic affair afford afraid again age agent agree ahead aim air airport aisle alarm album alcohol alert alien all alley allow almost alone alpha already also alter always amateur amazing among amount amused analyst anchor ancient anger angle angry animal ankle announce annual another answer antenna antique anxiety any apart apology appear apple approve april arch arctic area arena argue arm armed armor army around arrange arrest arrive arrow art artefact artist artwork ask aspect assault asset assist assume asthma athlete atom attack attend attitude attract auction audit august aunt author auto autumn average avocado avoid awake aw |
This file contains hidden or 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 Iterable, Sequence, Tuple | |
| def to_int_with_replacement(base: int, digits: Sequence[int]) -> int: | |
| if not digits: | |
| return 0 | |
| return digits[0] + base * to_int_with_replacement(base, digits[1:]) | |
| def to_int_without_replacement(nsyms: int, digits: Sequence[int]) -> int: | |
| if not digits: | |
| return 0 |
This file contains hidden or 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 Hide Substack comment-like-counts | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description Hide Substack comment-like-counts | |
| // @author https://github.com/speezepearson | |
| // @match https://*.substack.com/* | |
| // @grant none | |
| // ==/UserScript== |
This file contains hidden or 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
| extern crate proc_macro; | |
| use proc_macro::{TokenStream, TokenTree, Literal}; | |
| #[proc_macro_attribute] | |
| pub fn superstitious(_attr: TokenStream, item: TokenStream) -> TokenStream { | |
| panic_if_contains_13(item.clone()); | |
| item | |
| } | |
| fn panic_if_contains_13(ts: TokenStream) { |
This file contains hidden or 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 argparse | |
| import datetime | |
| import os | |
| from aiohttp import web | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument('--host', default='localhost') | |
| parser.add_argument('-p', '--port', default=8080) | |
| parser.add_argument('--refresh-time', default=300) |
This file contains hidden or 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
| # Put this in /etc/nginx/conf.d/SOME_NAME.conf | |
| # It should get included because of the | |
| # http { | |
| # include /etc/nginx/conf.d/*.conf; | |
| # } | |
| # in your /etc/nginx/nginx.conf | |
| server { | |
| listen 80; | |
| listen [::]:80; |
This file contains hidden or 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
| """Demo usage: python --open-browser $THIS_FILE | |
| """ | |
| import argparse | |
| import typing as t | |
| from aiohttp import web | |
| class Server: | |
| def __init__(self) -> None: | |
| pass |
This file contains hidden or 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 contextlib | |
| import json | |
| import subprocess | |
| from pathlib import Path | |
| from typing import Any, Collection, Iterator, Mapping | |
| JsonTrigger = Mapping[str, Any] | |
| @contextlib.contextmanager | |
| def with_triggers(dir: Path, triggers: Collection[JsonTrigger]) -> Iterator[None]: |
This file contains hidden or 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/bash | |
| # | |
| # Prefixed to a command, runs that command, and then makes a noise | |
| # indicating whether the command passed or failed. | |
| # | |
| # Ubuntu only. | |
| # | |
| if eval "$@"; then | |
| NAME='Mallet' |
NewerOlder