Skip to content

Instantly share code, notes, and snippets.

View touv's full-sized avatar

Nicolas Thouvenin touv

View GitHub Profile
comm -13 <(docker ps -a --format '{{.Names}}'|egrep "^\w+\-\w+\-.*$"|sed -e s/-[0-9]*$//g|sort|uniq) <(docker exec ezmaster_db mongo --quiet --eval 'db.adminCommand( { listDatabases: 1 } )'|jq -r '.databases[] | .name'|awk '{ print $1}'|sort|uniq)|awk '{print "docker exec ezmaster_db mongo",$1,"--eval \x27 db.dropDatabase(); \x27"}'
@touv
touv / httpd.conf
Created June 8, 2018 12:07
Apache reverse proxy conf for ezmaster
<VirtualHost *:443>
ServerName exemple.fr
ServerAlias *.exemple.fr
SSLEngine on
SSLProxyEngine on
@touv
touv / jason-toarray.sh
Created May 14, 2018 09:42
Exemple de passage du JSON vers des variables BASH
#!/bin/sh
# "DATABASES": [
# {
# "MYSQL_DATABASE": "database1",
# "MYSQL_USER": "user",
# "MYSQL_PASSWORD": "toto"
# },
# {
# "MYSQL_DATABASE": "database2",
@touv
touv / gist:d8f2f56efb11d76bcf06718c1b7e223a
Last active March 8, 2018 13:05
Enable Webcam in Windows guest on Ubuntu Virtualbox
VBoxManage list vms
VBoxManage list webcams
VBoxManage controlvm "vthouveni" webcam attach .1
@touv
touv / gist:435717cad174e16a61b891940ce0bb0a
Last active November 22, 2018 09:39
edit no_proxy in gnome settings
dconf-editor
and open dconf-editor -> system -> proxy
{
"get" : "doi",
"first" : true,
"resolveDOI" : true,
"$title" : {
"get" : "doi-publication-title",
"first" : true
},
"$issn" : {
"get" : "doi-ISSN",
@touv
touv / mongodb.md
Last active March 30, 2016 08:27
Launch MongoDB via Docker

Create & Run

docker run --net=host --name mongodb -v ${PWD}/.mongodb/data/db:/data/db -p 27017:27017 -d mongo:3.0 --smallfiles

Create the "mongodb" container :

docker create --net=host --name mongodb -v ${PWD}/.mongodb/data/db:/data/db -p 27017:27017 mongo:3.0 --smallfiles
@touv
touv / check-eth0.sh
Last active February 20, 2016 18:25
check if interface eth0 is up
cat /sys/class/net/eth0/operstate
@touv
touv / archive.sh
Last active February 20, 2016 18:26
rsync -avz /source /target
@touv
touv / addswap.sh
Last active June 29, 2017 19:13
Add swap on Ubuntu 14.04LTS
#!/bin/bash
sudo fallocate -l 4G /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon -s
# SWAP ENCRYPTION
# sudo ecryptfs-setup-swap