Skip to content

Instantly share code, notes, and snippets.

@alanepontesw
alanepontesw / list_s3.sh
Created June 8, 2020 12:57
List s3 public objects
bucket="my-bucket-name"
search_term="AllUsers"
for key in $(aws s3 ls --recursive s3://$bucket/ | awk '{$1=$2=$3=""; print $0}' | sed 's/^[ \t]*//'); do
acl=$(aws s3api get-object-acl --bucket $bucket --key $key) &&
result_found=$(echo $acl | grep -q $search_term) &&
if $result_found; then
echo $key;
echo $acl;
fi;
@alanepontesw
alanepontesw / macos-docker
Last active March 11, 2020 12:11
Instalation Docker MacOS
```
$ brew install docker-machine docker docker-compose
$ brew cask install virtualbox
# if you haven't the default created yet
$ docker-machine create -d virtualbox --virtualbox-memory 4096 default
# if you already have default created, do:
$ docker-machine start default
@alanepontesw
alanepontesw / debian-docker
Last active March 11, 2020 12:11
Instalation Docker Debian
If you're using Ubuntu/Debian follow these instructions:
```
$ sudo apt-get remove docker docker-engine docker.io containerd runc
$ sudo apt-get update
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
@alanepontesw
alanepontesw / docker-compose.yml
Created March 9, 2020 19:30
Sample of Docker Compose
version: "3"
services:
auth:
build:
context: .
ports:
- "9000:9000"
- "35729:35729"
volumes:
- .:/opt/node_app/app:delegated
@alanepontesw
alanepontesw / Dockerfile
Last active March 11, 2020 12:07
Sample of Dockerfile
FROM node:10.14.0-slim
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 \
NODE_PATH=/opt/node_app/node_modules \
PATH=$PATH:/opt/node_app/node_modules/.bin
RUN echo "fs.inotify.max_user_watches=524288" >> /etc/sysctl.conf \
&& npm install -g yarn@1.21.1 \
&& mkdir /opt/node_app

This is a demo of how to talk between programs running on a Mac, and programs running under Docker on a VM on the same Mac as installed by Docker Toolbox.

Just add a route to your containers using the VM as the gateway. Demo:

  • on the mac, run Docker Quickstart Terminal from the latest Docker Toolbox. This launches the virtualbox VM, and configures your shell
  • in that shell, figure out the IP address of the VM:
mak@crab 493 ~ $ docker-machine inspect default -f '{{ .Driver.IPAddress }} '
192.168.99.100 
@alanepontesw
alanepontesw / github-net-config.md
Created January 9, 2020 22:14 — forked from guilhermebruzzi/github-net-config.md
NET não libera a porta 22 e impede de acessar o github por ssh

Usar ssh do github com wifi do netcombo

A NET parece que só libera o uso de qualquer porta, como a porta 22 de ssh, para pessoa jurídica em seus novos planos (desde 2016).

Para conseguir usar o github por ssh com plano de internet da NET para pessoa física, é necessário:

Criar o arquivo ~/.ssh/config e adicionar:

Host github.com