Skip to content

Instantly share code, notes, and snippets.

View jordifebrer's full-sized avatar

Jordi Febrer jordifebrer

View GitHub Profile
@jordifebrer
jordifebrer / mongodb-docker-pymongo.md
Last active August 18, 2017 15:05
mongodb-docker-pymongo
# run mongo
$ docker run --rm --name my-mongo -it -p 27017:27017 mongo:3.2.7 
# or as a daemon
$ docker run --name my-mongo -d mongo:3.2.7

# connect to the previous container.. with another container
$ docker run -it --link my-mongo:mongo --rm mongo:3.2.7 sh -c 'exec mongo "$MONGO_PORT_27017_TCP_ADDR:$MONGO_PORT_27017_TCP_PORT/test"'
@jordifebrer
jordifebrer / oauth2.md
Last active October 24, 2023 07:59
Simplified OAuth 2 workflow for dummies (me!)

Simplified OAuth 2 workflow for dummies (me!)

User case

A user wants profile data from an app.

Workflow

  1. User makes a request to a client (website, mobile app, etc).
  2. Client (may) redirect the user to auth server login form.
  3. User logs into the auth server.
  4. Auth server validates previous credentials and returns an access token to the client.
@jordifebrer
jordifebrer / docker-json-server.sh
Last active November 7, 2022 14:03
docker-json-server.sh
#!/usr/bin/env bash
echo '{"cities": [{"name": "Barcelona"}, {"name": "Copenhagen"}, {"name": "Edinburgh"}, {"name": "Hanoi"}]}' > /tmp/cities.json
docker run -d -p 80:80 -v /tmp/cities.json:/data/db.json clue/json-server
# Listing my favourite cities
curl http://localhost/cities
[
{"name": "Barcelona"},
{"name": "Copenhagen"},
@jordifebrer
jordifebrer / docker-compose.yml
Created June 28, 2018 18:29
Waiting for a webserver container example
version: '3'
networks:
test_net:
services:
webserver:
image: nginx:alpine
command: sh -c 'sleep 10 && nginx -g "daemon off;"'
networks:
- test_net
@jordifebrer
jordifebrer / data_to_docker.md
Last active November 7, 2022 14:03
Copy/share data to a Docker container