+-------------------------------------------+
| |
| application |
| |
+---> +-----------+----------- |
| | | | |
api | | curio-api | trio-api | asyncio-libraries |
| | | | |
+---> +-----------+----------+------+ |
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 json | |
import logging | |
import re | |
import js2py | |
LOG = logging.getLogger(__name__) | |
RE_CODE_BLOCK = re.compile( | |
r'```(json)?\n?(.+)\n?```', re.MULTILINE | re.DOTALL |
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
[Unit] | |
Description=memory-monitor-jupyterhub | |
After=network.target | |
StartLimitIntervalSec=0 | |
[Service] | |
Type=simple | |
Restart=on-failure | |
RestartSec=10 | |
User=root |
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
// https://www.uscreditcards101.com/wp-content/cache/autoptimize/js/autoptimize_9a2cfd2fee7b6b64b5fa19e57f03bc6c.js | |
// https://www.uscreditcards101.com/how-to-use-plastiq-bill-pay/ | |
// https://www.v2ex.com/t/752795#reply113 | |
$(document).ready(function () { | |
setTimeout(function () { | |
var observer = new IntersectionObserver( | |
function (entries, observer) { | |
entries.forEach(function (entry) { | |
if (!entry.isIntersecting) return; | |
var options = JSON.parse(entry.target.getAttribute("data-options")); |
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 os | |
import random | |
import timeit | |
def random_content(): | |
return os.urandom(random.randint(1, 10) * 1024) | |
file = open('test.db', 'wb') |
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
#!/usr/bin/env python | |
""" | |
Binary file diff | |
Usage: | |
bindiff <FILE> <FILE> | |
Install: | |
curl -L https://gist.githubusercontent.com/guyskk/98621a9785bd88cf2b4e804978950122/raw/efc200c6e45c3ef503249cf3b151fb8a1f5b75cb/bindiff.py -o bindiff && chmod +x bindiff | |
""" | |
import io | |
import sys |
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
""" | |
Requirements: | |
pip install pandas msgpack dask tqdm loguru | |
Usage: | |
import pandas as pd | |
from pandas_parallel import pandas_parallel | |
df = pd.DataFrame.from_records([ | |
['A', 1, 2], |
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
""" | |
Add command history and tab completion to python shell. | |
1. Save this file in ~/.pythonrc.py | |
2. Add the following line to your ~/.bashrc: | |
export PYTHONSTARTUP="$HOME/.pythonrc.py" | |
""" | |
def _enable_history_and_completer(): |
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
""" | |
Non-blocking will block on busy syscall! | |
两条数据流形成一个环,预先填充128字节数据。 | |
Producer和Consumer驱动数据在环中流动。 | |
+----------------+ | |
| | | |
+ v | |
producer consumer |
NewerOlder