When applications are running in production, they become black boxes that need to be traced and monitored. One of the simplest, yet main, ways to do so is logging. Logging allows us - at the time we develop our software - to instruct the program to emit information while the system is running that will be useful for us and our sysadmins.
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
| # v1beta1.Deployment: Deployment enables declarative updates for Pods and ReplicaSets. | |
| # (apiVersion <string>): APIVersion defines the versioned schema of this | |
| # representation of an object. Servers should convert recognized schemas to the | |
| # latest internal value, and may reject unrecognized values. More info: | |
| # http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources | |
| apiVersion: | |
| # (kind <string>): Kind is a string value representing the REST resource this | |
| # object represents. Servers may infer this from the endpoint the client submits | |
| # requests to. Cannot be updated. In CamelCase. More info: |
CouchDB is a NoSQL database for storing JSON documents. It comes with a REST API out of the box so your client applications can persist data while requiring you to write little or no server-side code. CouchDB's killer feature is its ability to easily replicate, which allows for horizontal scaling, easy backup, and for client adapters to synchronize documents. This is perfect if you want to write an application that is offline-first. It's become my go-to database when creating new
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 asyncio | |
| import random | |
| class Hub(): | |
| def __init__(self): | |
| self.subscriptions = set() | |
| def publish(self, message): |
-
Install [pyenv][] using [pyenv-installer][]:
curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash -
Activate pyenv for Terminal:
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
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 logging | |
| import sys | |
| import threading | |
| from tornado import ioloop, gen | |
| from motor import MotorClient | |
| from pymongo import monitoring | |
| logging.basicConfig(stream=sys.stdout, level=logging.INFO) |
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
| ## Useful Commands | |
| Get kubectl version | |
| kubectl version | |
| Get cluster info: |
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
| const compose = (...fns) => fns.reduce((f, g) => (...args) => f(g(...args))) | |
| // Usage : compose functions right to left | |
| // compose(minus8, add10, multiply10)(4) === 42 | |
| // | |
| // The resulting function can accept as many arguments as the first function does | |
| // compose(add2, multiply)(4, 10) === 42 |
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
| GATEWAY_FLAGS := -I. -I/usr/local/include -I$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis -I/usr/local/include | |
| GRPC_FLAGS := --python_out=. --grpc_python_out=. | |
| code: | |
| python -m grpc_tools.protoc $(GRPC_FLAGS) $(GATEWAY_FLAGS) *.proto | |
| gw: | |
| protoc $(GATEWAY_FLAGS) \ | |
| --go_out=Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api,plugins=grpc:. \ |
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
| Using FFMPEG | |
| --- | |
| ffmpeg -i input.mp4 -s 320x240 -b 64k -vcodec mpeg1video -acodec copy output.mp4 | |
| Change parameters to get tradeoff quality and size | |
| - Resolution via -s 320x240 | |
| - Bitrate via -b 64k | |
| Using AVCONV |
