Skip to content

Instantly share code, notes, and snippets.

@nkhitrov
nkhitrov / structlog_fastapi.py
Created March 16, 2023 00:04
Structlog FastAPI example
"""
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

Books

  • Working Effectively With Legacy Code by Michael Feathers
  • Beyond Legacy Code by David Scott Bernstein
  • Getting Started With DDD When Surrounded By Legacy Systems by Eric Evans

Podcasts

Legacy Code Rocks Menders love fixing bugs, refactoring, and testing to make software applications more stable, scalable and secure.

Maintainable FM

@stettix
stettix / things-i-believe.md
Last active March 20, 2024 17:45
Things I believe

Things I believe

This is a collection of the things I believe about software development. I have worked for years building backend and data processing systems, so read the below within that context.

Agree? Disagree? Feel free to let me know at @JanStette. See also my blog at www.janvsmachine.net.

Fundamentals

Keep it simple, stupid. You ain't gonna need it.

@uhho
uhho / pandas_s3_streaming.py
Last active December 2, 2022 18:57
Streaming pandas DataFrame to/from S3 with on-the-fly processing and GZIP compression
def s3_to_pandas(client, bucket, key, header=None):
# get key using boto3 client
obj = client.get_object(Bucket=bucket, Key=key)
gz = gzip.GzipFile(fileobj=obj['Body'])
# load stream directly to DF
return pd.read_csv(gz, header=header, dtype=str)
def s3_to_pandas_with_processing(client, bucket, key, header=None):
import scala.collection.immutable.List
object StackLanguage extends App {
var program = List(Value(1), Value(2), Value(3), Operator(_ + _), Operator(_ - _), UnaryOperator(Math.sqrt(_).toInt))
println("Tim & Matt lovin the Scalay goodness")
def evaluate_stack(stack: List[Element]) = {
stack match {
@yang-wei
yang-wei / destructuring.md
Last active February 20, 2024 04:40
Elm Destructuring (or Pattern Matching) cheatsheet

Should be work with 0.18

Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !

Tuple

myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))
@danielerapati
danielerapati / battleship.erl
Created January 19, 2016 21:54
Erlang battleship: January 2016 West London Hacknight
-module(battleship).
-import(sets,[new/0, add_element/2, is_element/2]).
-import(lists,[foldl/3]).
-export([new_grid/0]).
-export([new_grid/2]).
-export([fill_cell/2]).
@bishboria
bishboria / springer-free-maths-books.md
Last active June 8, 2024 06:39
Springer made a bunch of books available for free, these were the direct links
@mgold
mgold / using_mailboxes_in_elm.md
Last active March 24, 2020 16:05
Using Mailboxes in Elm: a tutorial blog post

Using Mailboxes in Elm

Max Goldstein | July 30, 2015 | Elm 0.15.1

In Elm, signals always have a data source associated with them. Window.dimensions is exactly what you think it is, and you can't send your own events on it. You can derive your own signals from these primitives using map, filter, and merge, but the timing of events is beyond your control.

This becomes a problem when you try to add UI elements. We want to be able to add checkboxes and dropdown menus, and to receive the current state of these elements as a signal. So how do we do that?

The Bad Old Days

@maruks
maruks / dojo4.erl
Created July 21, 2015 22:17
July Hack Night
-module(dojo4).
-import(lists,[nth/2]).
-include_lib ("eunit/include/eunit.hrl").
-compile(export_all).
rand_list(Size) ->
lists:map(fun(X)-> random:uniform(100) end, lists:seq(1,Size)).
grid(Size) ->
lists:map(fun(X)-> rand_list(Size) end, lists:seq(1,Size)).