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 flask import Flask | |
import random | |
import re | |
import chardet | |
app = Flask(__name__) | |
def detect_encoding(filename): | |
with open(filename, 'rb') as f: | |
raw_data = f.read() |
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
file:///Users/cohen/midas-configuration/node_modules/axios/lib/core/settle.js:19 | |
reject(new AxiosError( | |
^ | |
AxiosError: Request failed with status code 413 | |
at settle (file:///Users/cohen/midas-configuration/node_modules/axios/lib/core/settle.js:19:12) | |
at Unzip.handleStreamEnd (file:///Users/cohen/midas-configuration/node_modules/axios/lib/adapters/http.js:570:11) | |
at Unzip.emit (node:events:525:35) | |
at Unzip.emit (node:domain:489:12) | |
at endReadableNT (node:internal/streams/readable:1359:12) | |
at processTicksAndRejections (node:internal/process/task_queues:82:21) { |
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 Remove Verified and Blocked Accounts on Twitter Scroll | |
// @namespace remove-verified-blocked-accounts-on-twitter-scroll | |
// @version 1 | |
// @description Remove verified and blocked accounts when you finish scrolling down the Twitter feed. | |
// @match https://twitter.com/* | |
// @grant none | |
// ==/UserScript== | |
(function() { |
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
#include "modes/PikaPalBattlefield.hpp" | |
#define ANALOG_STICK_MIN 48 | |
#define ANALOG_STICK_NEUTRAL 128 | |
#define ANALOG_STICK_MAX 208 | |
#define ANALOG_STICK_NEUTRAL_TO_EDGE 80 | |
PikaPalBattlefield::PikaPalBattlefield(socd::SocdType socd_type) : ControllerMode(socd_type) { | |
_socd_pair_count = 4; | |
_socd_pairs = new socd::SocdPair[_socd_pair_count]{ |
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 Any, Callable, Optional, Type, TypeVar | |
from mypy.plugin import Plugin, FunctionContext # pylint: disable=no-name-in-module | |
from mypy.types import TypedDictType # pylint: disable=no-name-in-module | |
A = TypeVar('A') | |
def safe_typeddict_cast(_: Type[A], data: Any) -> A: | |
# This function does nothing on its own, but the types are checked in mypy_plugin.py. | |
# The goal is to safely convert the data argument to the type of the first argument. | |
# The type will only be converted if it passes type checks. If it doesn't 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
class CustomPlugin(Plugin): | |
def get_class_decorator_hook(self, fullname: str) -> Optional[Callable[[ClassDefContext], None]]: | |
def add_attributes_to_class_def_context(cls_def_context: ClassDefContext) -> None: | |
# Add types for values injected by container.inject | |
info = cls_def_context.cls.info | |
if fullname == 'nook.container' and 'primary_model' in info.names: | |
# import pdb | |
# pdb.set_trace() | |
# # TODO: Delete | |
for idx in range(len(cls_def_context.reason.arg_names)): |
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
Commands are written in quotes below. u=up, r=right, d=down, and l=left. | |
Quick start: | |
Switch characters (defaults to P1): "p1" or "p2" | |
Move in a direction: "u" / "r" / "d" / "l" | |
Weak attack (A button): "a" | |
Medium attacks (directional): "tu", "tr", "td", "tl" | |
Strong attacks (C-stick directions): "cu" / "cr" / "cd" / "cl" | |
Jump: "j" | |
Special moves (directional): "bu" / "br" / "bd" / "bl" |
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
# Add these to your .bashrc for fancy git logging: | |
# This optionally accepts a number as an argument (e.g. `gl 10`) to show that many commits. | |
# `gl` by itself will show all commits like a normal `git log`. | |
function gl { | |
if [ -z "$1" ] | |
then | |
git log --pretty=format:'%C(bold blue)%h %C(bold green)(%ar) %C(magenta)%an %Creset%s%C(bold yellow)%d' | |
else | |
git log --pretty=format:'%C(bold blue)%h %C(bold green)(%ar) %C(magenta)%an %Creset%s%C(bold yellow)%d' -$1 |
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
" Add this to your .vimrc and you will be able to use ':Ag <pattern>' to silver search from wherever you opened vim. | |
" You can also use 'ack' or whatever you want to use as a search tool as long as you have it installed. | |
if executable('ag') | |
set grepprg=ag\ --nogroup\ --nocolor | |
command! -nargs=+ -complete=file -bar Ag silent! grep! <args>|cwindow|redraw! | |
endif | |
" When you use ':Ag <pattern>' you can quickly look through / search each file containing the pattern and pick one to edit. | |
" YOU CAN ALSO DO ':cfdo <command>' TO RUN A COMMMAND ON EACH FILE IN THE SEARCH RESULT!!! |
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
# Fancy git log. 'gl' shows the whole log, 'gl 5' shows the last 5 commits, etc. | |
function gl { | |
if [ -z "$1" ] | |
then | |
git log --graph --pretty=format:'%C(bold blue)%h %C(bold green)(%ar) %C(magenta)%an %Creset%s%C(bold yellow)%d' | |
else | |
git log --graph --pretty=format:'%C(bold blue)%h %C(bold green)(%ar) %C(magenta)%an %Creset%s%C(bold yellow)%d' -$1 | |
fi | |
} |
NewerOlder