Skip to content

Instantly share code, notes, and snippets.

View nevmerzhitsky's full-sized avatar
🪀

Sergey Nevmerzhitsky nevmerzhitsky

🪀
  • 05:36 (UTC +05:00)
View GitHub Profile
@nevmerzhitsky
nevmerzhitsky / run.sh
Last active July 18, 2020 12:49
Run a docker container with a timeout
#!/usr/bin/env bash
TIMEOUT=1m
IMAGE=nginx:latest
CONTAINER_ID=
term_handler() {
# This catch both temporary and persistent containers
if docker inspect -f {{.State.Running}} $CONTAINER_ID > /dev/null; then
docker rm -f $CONTAINER_ID > /dev/null
fi
@nevmerzhitsky
nevmerzhitsky / docker-compose.override.yml
Created February 19, 2018 18:36
Top bind mount for development via Docker
version: "3.3"
services:
foo_container:
volumes:
- type: bind
source: ./foo_container/.bash_history
target: /root/.bash_history
@nevmerzhitsky
nevmerzhitsky / no-oom.sh
Last active April 10, 2018 09:15
Wrapper of a process without OOM watching
#!/bin/bash
# Works bad with termination of children processes when started via sudo. Please, run as super-user.
if [ "$1" == "" ]; then
echo "Usage: no-oom <a line to start new process>" 1>&2
exit 1
fi
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi