Skip to content

Instantly share code, notes, and snippets.

@plutov
plutov / ttlmap.go
Last active December 2, 2024 18:39
ttlmap.go
package ttlmap
import (
"sync"
"time"
)
// item is a struct that holds the value and the last access time
type item struct {
value interface{}
@plutov
plutov / books.md
Last active September 22, 2024 13:21
Books for Engineering Managers

We live in a world where there are so many offerings of information in all possible formats: podcasts, videos, blogs, etc. But reading a good book is something that you'll never regret.

In the following list I'd like to cover some books that helped me personally at becoming a better engineer and manager.

Note: I have used some links to Amazon and it's not affiliated.

Will Larson's An Elegant Puzzle orients around the particular challenges of engineering management--from sizing teams to technical debt to succession planning--and provides a path to the good solutions. Drawing from his experience at Digg, Uber, and Stripe, Will Larson has developed a thoughtful approach to engineering management that leaders of all levels at companies of all sizes can apply. An Elegant Puzzle balances structured principles and human-centric thinking to help any leader create more effective and rewarding organizations for engineers to thr

@plutov
plutov / frames.py
Created May 7, 2024 13:47
frames.py
from pathlib import Path
from collections.abc import Iterator
import sys
import json
import dataclasses
THREADS_SEPARATOR = "DALVIK THREADS:"
def parse(lines: list) -> list:
// ...
var (
backgroundColor = color.RGBA{50, 100, 50, 50}
snakeColor = color.RGBA{200, 50, 150, 150}
foodColor = color.RGBA{200, 200, 50, 150}
)
type Game struct {
input *Input
package snake
import (
"math/rand"
"time"
"github.com/hajimehoshi/ebiten/v2"
)
type Board struct {
package snake
import "github.com/hajimehoshi/ebiten/v2"
type Coord struct {
x, y int
}
type Snake struct {
body []Coord
package snake
import (
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/inpututil"
)
type Input struct{}
func NewInput() *Input {
package snake
type Food struct {
x, y int
}
func NewFood(x, y int) *Food {
return &Food{
x: x,
y: y,
package main
import (
"log"
"github.com/hajimehoshi/ebiten/v2"
"github.com/plutov/packagemain/drafts/ebiten-snake/snake"
)
func main() {
@plutov
plutov / game.go
Last active February 22, 2024 10:01
package snake
import (
"fmt"
"image/color"
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/ebitenutil"
)