Skip to content

Instantly share code, notes, and snippets.

# 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:
@mariocj89
mariocj89 / python-logging.md
Last active May 11, 2025 11:14
Understanding logging in Python

Logging trees

Introduction

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.

@Ravenstine
Ravenstine / aws-couchdb-setup.md
Last active February 18, 2025 03:56
Fast CouchDB setup in AWS

Fast CouchDB setup in AWS

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

@appeltel
appeltel / pubsub.py
Last active July 31, 2025 13:43
asyncio pubsub example
import asyncio
import random
class Hub():
def __init__(self):
self.subscriptions = set()
def publish(self, message):
@gsong
gsong / pyenv-setup.md
Last active September 11, 2018 06:44
Pyenv Setup Step-by-step
  1. Install [pyenv][] using [pyenv-installer][]:

    curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
  2. Activate pyenv for Terminal:

    echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
@ajdavis
ajdavis / motor-monitoring.py
Last active January 15, 2019 07:39
Example of MongoDB driver event monitoring with Motor. See https://emptysqua.re/blog/motor-monitoring/
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)
## Useful Commands
Get kubectl version
kubectl version
Get cluster info:
@WaldoJeffers
WaldoJeffers / compose.js
Last active August 6, 2025 13:37
JavaScript one-line compose (ES6)
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
@doubleyou
doubleyou / Makefile
Last active September 23, 2024 11:45
grpc-gateway python example
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:. \
@aakbar5
aakbar5 / ffmpeg -- Reduce video size
Last active November 26, 2023 09:51
Video -- Reduce video size
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