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
@fardjad
fardjad / how-to-start-colima-automatically-on-macos.md
Last active February 2, 2024 05:09
[How to start Colima automatically on macOS] Instructions for starting Colima automatically on macOS similar to Docker Desktop #macos #colima #docker

⚠️ Note: Since the merge of commit Homebrew/homebrew-core#149670, starting Colima is as easy as running brew services start colima. You can skip the following work-around.

Steps

  1. Create an executable script to run in foreground and manage colima:
cat <<-EOF | sudo tee /usr/local/bin/colima-start-fg
#!/bin/bash
# nim c -r --threads:on --gc:orc
import cpuinfo, os, random, locks, deques
type
WorkReq = ref object
id: int
WorkRes = ref object
id: int
@nileshtrivedi
nileshtrivedi / home-server.md
Last active January 10, 2024 06:30
Home Server setup: Raspberry PI on Internet via reverse SSH tunnel

Raspberry Pi on Internet via reverse SSH tunnel

HackerNews discussed this with many alternative solutions: https://news.ycombinator.com/item?id=24893615

I already have my own domain name: mydomain.com. I wanted to be able to run some webapps on my Raspberry Pi 4B running perpetually at home in headless mode (just needs 5W power and wireless internet). I wanted to be able to access these apps from public Internet. Dynamic DNS wasn't an option because my ISP blocks all incoming traffic. ngrok would work but the free plan is too restrictive.

I bought a cheap 2GB RAM, 20GB disk VM + a 25GB volume on Hetzner for about 4 EUR/month. Hetzner gave me a static IP for it. I haven't purchased a floating IP yet.

@madars
madars / public-tmux
Created April 30, 2020 01:46
A read-only tmux session for demos and remote debugging
#!/bin/sh
# To be used with something like this in sshd_config:
#
# Match User public-tmux
# X11Forwarding no
# AllowTcpForwarding no
# PasswordAuthentication yes
# ForceCommand /usr/bin/tmux -S /tmp/public-tmux-socket attach -r -t public
#
@lunks
lunks / gruvbox-dark.conf
Last active April 25, 2024 04:21
gruvbox-dark theme for kitty - the fast, featureful, GPU based terminal emulator
# gruvbox-dark colorscheme for kitty
# snazzy theme used as base
foreground #ebdbb2
background #272727
selection_foreground #655b53
selection_background #ebdbb2
url_color #d65c0d
# black
@fliphess
fliphess / sentry.py
Last active December 13, 2022 20:02
Ansible sentry callback plugin - Send all errors from ansible to Sentry
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import getpass
import logging
import logging.config
import os
import socket
try:
@livingspeedbump
livingspeedbump / WhiteFox-Aria.kbd.json
Last active December 20, 2020 18:55
WhiteFox Aria
[
{
"name": "WhiteFox Aria"
},
[
{
"c": "#0084c2"
},
"Esc",
"!\n1",
from click import command, option, Option, UsageError
class MutuallyExclusiveOption(Option):
mutex_groups = {}
def __init__(self, *args, **kwargs):
opts_list = kwargs.pop('mutex_group', "")
self.mutex_group_key = ','.join(opts_list)
self.mutex_groups[self.mutex_group_key] = 0
help = kwargs.get('help', '')
@hynek
hynek / gunicorn_callbacks_for_worker_id.py
Last active March 6, 2024 04:55
This is an attempt to emulate uWSGI’s uwsgi.worker_id() that ensures that I have worker IDs from 1…--workers which is useful in logging and instrumentation where changing PIDs are annoying.
import os
def on_starting(server):
"""
Attach a set of IDs that can be temporarily re-used.
Used on reloads when each worker exists twice.
"""
server._worker_id_overload = set()