Notes on this tweet.
-
The screenshots were taken on different sessions.
-
The entire sessions are included on the screenshots.
-
I lost the original prompts, so I had to reconstruct them, and still managed to reproduce.
-
The "compressed" version is actually longer! Emojis and abbreviations use more tokens than common words.
""" | |
Structlog example configuration with FastAPI. | |
Features: | |
- async bound logger | |
- contextvars to log request-id and other meta data | |
- custom format for default logging loggers and structlog loggers | |
""" | |
import asyncio | |
import logging |
I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.
I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real
def is_valid_state(state): | |
# check if it is a valid solution | |
return True | |
def get_candidates(state): | |
return [] | |
def search(state, solutions): | |
if is_valid_state(state): | |
solutions.append(state.copy()) |
# aproducer.py | |
# | |
# Async Producer-consumer problem. | |
# Challenge: How to implement the same functionality, but no threads. | |
import time | |
from collections import deque | |
import heapq | |
class Scheduler: |
apt-get install python-pip
pip install shadowsocks
sudo ssserver -p 443 -k password -m aes-256-cfb --user nobody -d start
1. `vim /etc/syslog.conf` | |
2. Add to end of file: `cron.* /var/log/cron.log` | |
3. | |
``` | |
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.syslogd.plist | |
sudo launchctl load /System/Library/LaunchDaemons/com.apple.syslogd.plist | |
``` | |
[where-is-the-cron-log-file-in-macosx-lion](http://apple.stackexchange.com/questions/38861/where-is-the-cron-log-file-in-macosx-lion) |
Just create a new InterceptHandler and add it to your app. Different settings should be configured in your config file, so that it is easy to change settings.
Logging is then as easy as:
from loguru import logger
logger.info("I am logging from loguru!")