Skip to content

Instantly share code, notes, and snippets.

View osallou's full-sized avatar

Olivier Sallou osallou

View GitHub Profile
@osallou
osallou / gist:5521265b555b449315f29f2881f52e3b
Created June 8, 2018 12:42
delete redis keys by regexp
redis-cli --raw keys "$PATTERN" | xargs redis-cli del
ps f -eo pid,uid,gid,user,pgrp,command
@osallou
osallou / gist:c83d2ec7395d6571902b788cc057831d
Created October 28, 2017 11:20
Get local network dns info to specify dns address in docker run commands
certains réseaux bloquent en effet les requetes DNS extérieures et force leur DNS. Dans ce cas il faut spécifier le dns "local"
some networks prevent using external dns (google, etc.), and force the use of their dns.
With docker, depending on network config, one need to specify on command-line the used dns.
docker run ... --dns a.b.c.d ....
Local dns info can be found with:
nmcli dev show | grep DNS
@osallou
osallou / get_volume_mounts.sh
Created October 23, 2017 10:39 — forked from mbentley/get_volume_mounts.sh
Get docker volume mounts via `docker inspect`
for i in $(docker ps -aq)
do
echo -n "Volumes for ${i}: "
docker inspect --format '{{ range .Mounts }}{{ .Name }} {{ end }}' ${i}
done
@osallou
osallou / gist:1719d643a42b6682be012645c6aeda8b
Created April 19, 2017 14:35
mailhog: launch an smtp server with web ui for testing
sudo docker run --rm -d -p 1025:1025 -p 8025:8025 mailhog/mailhog
configure smtp client to send to port 1025
web ui on port 8025
@osallou
osallou / gist:ff4ffb6d56e971c0714df83c049fb8c9
Created January 15, 2017 08:10
install debian packages from file list
apt-get install $(grep -vE "^\s*#" filename | tr "\n" " ")
To send dcut command to delete uploaded packages
dcut rm -f x.y.changes
to launch agent on same node than server add --link
docker run --link happy_meninsky:dockerdevng.genouest.org -e CATTLE_AGENT_IP="dockerdevng.genouest.org" -d --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.0.1 http://dockerdevng.genouest.org:8080/v1/scripts/TOKEN
@osallou
osallou / gist:b8ad35d491ae25e432cf
Last active March 18, 2016 08:11
Rebase all commits in a single commit
# Switch to the master branch and make sure you are up to date.
git checkout master
git fetch # this may be necessary (depending on your git config) to receive updates on origin/master
git pull
# Merge the feature branch into the master branch.
git merge feature_branch
# Reset the master branch to origin's state.
git reset origin/master # or commit id
from docker import Client
import datetime
import time
import logging
from subprocess import Popen, PIPE
today = datetime.datetime.now()
timestamp = time.mktime(today.timetuple())
cli = Client(base_url='unix://var/run/docker.sock')