Skip to content

Instantly share code, notes, and snippets.

@akrylysov
akrylysov / README.md
Last active May 2, 2024 13:28
Fast Intel-on-ARM Docker on macOS with Lima and Rosetta

macOS 13 Ventura introduced support of running amd64 binaries with Rosetta inside of arm64 Linux VMs when using Apple Virtualization framework.

Lima VM v0.14.0 and later support the new feature.

Setup:

# Install Docker client and Lima
brew install docker docker-compose docker-credential-helper lima
FROM ubuntu:16.04
RUN echo "deb http://ppa.launchpad.net/maxmind/ppa/ubuntu trusty main" > /etc/apt/sources.list.d/maxmind.list \
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys "DE742AFA" \
&& apt-get update \
&& apt-get install -y cron geoipupdate \
&& apt-get -qy autoremove \
&& apt-get clean \
&& rm -r /var/lib/apt/lists/*
RUN touch /var/log/cron.log
RUN (crontab -l ; echo "15 0 * * * geoipupdate -v > /proc/1/fd/1 2>/proc/1/fd/2") | crontab
@akrylysov
akrylysov / aws_billing.sql
Created December 13, 2017 16:55
AWS billing Athena schema
CREATE EXTERNAL TABLE `billing`(
`invoiceid` string,
`payeraccountid` string,
`linkedaccountid` string,
`recordtype` string,
`recordid` string,
`productname` string,
`rateid` string,
`subscriptionid` string,
`pricingplanid` string,
@akrylysov
akrylysov / iab_categories_openrtb2.4.json
Created November 2, 2016 14:20
List of IAB categories from OpenRTB 2.4 specification in JSON format
{
"IAB1": "Arts & Entertainment",
"IAB1-1": "Books & Literature",
"IAB1-2": "Celebrity Fan/Gossip",
"IAB1-3": "Fine Art",
"IAB1-4": "Humor",
"IAB1-5": "Movies",
"IAB1-6": "Music",
"IAB1-7": "Television",
"IAB2": "Automotive",
@akrylysov
akrylysov / keybase.md
Created August 17, 2016 02:37
keybase.md

Keybase proof

I hereby claim:

  • I am akrylysov on github.
  • I am akrylysov (https://keybase.io/akrylysov) on keybase.
  • I have a public key whose fingerprint is 2BAC 8CF8 ED63 6AE5 0C0E 6581 8986 FA39 F657 678A

To claim this, I am signing this object:

@akrylysov
akrylysov / asyncio_producer_consumer.py
Last active January 10, 2023 17:04
Python 3 asyncio basic producer / consumer example
import asyncio
import random
q = asyncio.Queue()
async def producer(num):
while True:
await q.put(num + random.random())
await asyncio.sleep(random.random())