Skip to content

Instantly share code, notes, and snippets.

View megahertz's full-sized avatar
:electron:

Alex Prokhorov megahertz

:electron:
  • Thailand
  • 02:47 (UTC +07:00)
View GitHub Profile
@megahertz
megahertz / docker-gemini
Created February 16, 2026 10:36
There's a `docker sandbox run gemini` command, but it requires Docker Desktop to be installed, which is pretty undesirable on Linux since it replaces Docker Engine with a VM environment. This simple script does similar things.
#!/usr/bin/env bash
set -e
image='docker/sandbox-templates:gemini'
case "$1" in
-h|--help)
echo 'Usage: docker-gemini [options] [command] [prompt]'
echo 'docker-gemini commands:'
@megahertz
megahertz / docker-codex
Created February 16, 2026 10:35
There's a `docker sandbox run codex` command, but it requires Docker Desktop to be installed, which is pretty undesirable on Linux since it replaces Docker Engine with a VM environment. This simple script does similar things.
#!/usr/bin/env bash
set -e
image='docker/sandbox-templates:codex'
case "$1" in
-h|--help)
echo 'Usage: docker-codex [options] [command] [prompt]'
echo 'docker-codex commands:'
@megahertz
megahertz / git-unbranch
Created January 21, 2026 02:19
Removes any local branches except for main/master and pulls the latest changes from the origin. It's helpful to run once a feature has been merged
#!/usr/bin/env sh
set -e
master_names='main|master'
branch_regexp='s/[^A-Za-z0-9_\/-]*//g'
master_branch="$(git branch | grep -E "${master_names}" | sed "${branch_regexp}" | head -n 1)"
branches="$(git branch | grep -v -E "${master_names}" | sed "${branch_regexp}")"
@megahertz
megahertz / docker-claude
Last active February 16, 2026 10:34
There's a `docker sandbox run claude` command, but it requires Docker Desktop to be installed, which is pretty undesirable on Linux since it replaces Docker Engine with a VM environment. This simple script does similar things.
#!/usr/bin/env bash
set -e
image='docker/sandbox-templates:claude-code'
case "$1" in
-h|--help)
echo 'Usage: docker-claude [options] [command] [prompt]'
echo 'docker-claude commands:'
@megahertz
megahertz / mongo-url.sh
Created February 28, 2018 04:10
Parse MongoDB connection string in bash
#!/usr/bin/env bash
set -e
# Usage: parse_mongo_url URL
# It sets the following variables:
# MONGO_HOST
# MONGO_PORT
# MONGO_DATABASE
# MONGO_USER
# MONGO_PASSWORD
@megahertz
megahertz / MobxRnnProvider.js
Last active January 11, 2020 09:56
This is a provider which allows to use mobx-react Provider with wix/react-native-navigation.
import { Provider } from 'mobx-react/native';
const SPECIAL_REACT_KEYS = { children: true, key: true, ref: true };
export default class MobxRnnProvider extends Provider {
props: {
store: Object
};
context: {