Skip to content

Instantly share code, notes, and snippets.

@atanasyanew
atanasyanew / docker-compose-samba.yml
Created January 23, 2020 14:47
Raspberry Pi docker compose Samba NAS
version: '3.4'
services:
samba:
image: dperson/samba:armhf
container_name: samba
environment:
TZ: Europe/Sofia
USERID: 1000
GROUPID: 1000
@ben-cohen
ben-cohen / shared_mutex.c
Created July 12, 2017 19:25
Mutex in mmap memory shared between processes.
/*
* shared_mutex: Mutex in mmap memory shared between processes.
*
* Ben Cohen, July 2017.
*
* Compile using:
* gcc -o shared_mutex shared_mutex.c -ggdb -Wall -std=c99 -pthread
*
* Two processes are created with an mmap shared memory region
* containing an array of chars and a mutex. The mutex is created with
@BretFisher
BretFisher / docker-for-mac.md
Last active May 15, 2024 05:19
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


import groovy.json.JsonSlurper
import org.sonatype.nexus.repository.storage.Asset
import org.sonatype.nexus.repository.storage.StorageFacet
def DOCKER_REPOSITORY_NAME = 'docker-hosted'
def dockerRepository = repository.repositoryManager.get(DOCKER_REPOSITORY_NAME)
def dockerBlobStore = blobStore.blobStoreManager.get(dockerRepository.configuration.attributes.storage.blobStoreName)
def storageTx = dockerRepository.facet(StorageFacet.class).txSupplier().get()
try {
@efrecon
efrecon / run.tpl
Last active May 15, 2024 09:06
`docker inspect` template to regenerate the `docker run` command that created a container
docker run \
--name {{printf "%q" .Name}} \
{{- with .HostConfig}}
{{- if .Privileged}}
--privileged \
{{- end}}
{{- if .AutoRemove}}
--rm \
{{- end}}
{{- if .Runtime}}
@fntlnz
fntlnz / establish-routing-to-docker-osx-container-network
Last active March 29, 2019 18:07 — forked from bhyde/establish-routing-to-boot2docker-container-network
establish-routing-to-docker-osx-container-network
#!/bin/bash
# Script to instruct the Mac how to route packets to the
# software defined network where containers created via boot2docker
# reside. This lets you casually directly to ports (ssh, http, etc. etc.)
# on those containers.
function ERROR(){ echo "ERROR: $*" ; }
function FAIL(){ echo "FAILING: $*" ; exit 1; }
IP_OF_DOCKER_HOST="172.16.42.43"
SDN_NET_FOR_CONTAINERS=$(docker-osx ssh -c 'ip route show' 2> /dev/null | awk '/docker0/{print $1}' )