Skip to content

Instantly share code, notes, and snippets.

View pvgomes's full-sized avatar
:octocat:
Focusing

Paulo Victor L.L. Gomes pvgomes

:octocat:
Focusing
View GitHub Profile
@pvgomes
pvgomes / slack_lambda.py
Created September 28, 2017 19:52
Slack lambda
import logging
log = logging.getLogger()
log.setLevel(logging.DEBUG)
def lambda_handler(event, context):
bot_event = event
command = bot_event['text']
print command
print(event)
@pvgomes
pvgomes / Dockerfile_node-nginx-alpine
Last active September 19, 2017 14:48
Dockerfile_node-nginx-alpine
FROM alpine:3.3
MAINTAINER Paulo Gomes <pv.gomes89@gmail.com>
#Update and Intalation Ubuntu Packages
RUN apk update && \
apk upgrade && \
apk add --update \
nginx \
nodejs
@pvgomes
pvgomes / RubyReadFile.rb
Last active August 11, 2017 14:53
RubyReadFile.rb
keys = File.readlines('keys.txt');
keys.each do |key|
puts key
end
@pvgomes
pvgomes / GIF-Screencast-OSX.md
Created April 9, 2017 15:05 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@pvgomes
pvgomes / Simple mock api example
Created February 16, 2017 17:46
Mock api - up -> php -S 0.0.0.0:80 mock.php
<?php
require __DIR__ . 'vendor/autoload.php';
error_reporting(-1);
ini_set('display_errors', '1');
$r3 = new Respect\Rest\Router;
$r3->get('/ping', function() {
return 'pong';
});
@pvgomes
pvgomes / Dockerfile
Created December 12, 2016 19:27
Dockerfile PHP 7 NGINX alpine linux
# Use Alpine Linux
FROM alpine:edge
# Timezone
ENV TIMEZONE America/Sao_Paulo
ENV PHP_MEMORY_LIMIT 512M
ENV MAX_UPLOAD 50M
ENV PHP_MAX_FILE_UPLOAD 200
ENV PHP_MAX_POST 100M
# HINTS
## Add self to the docker group (run docker without sudo)
sudo gpasswd -a myusername docker
## Get container ID
alias dl='docker ps -l -q'
## Get container IP
docker inspect --format='{{ .NetworkSettings.IPAddress }}' `dl`
docker inspect `dl` | grep IPAddress | cut -d '"' -f 4
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
@pvgomes
pvgomes / gist:9f19e80454bb56565ee9
Created November 19, 2014 11:45
Difference between save and export
As I described in my last post (http://tuhrig.de/difference-between-save-and-export-in-docker), there are two ways to persist a Docker images or container:
A Docker image can be saved to a tarball and loaded back again. This will preserve the history of the image.
# save the image to a tarball
docker save <IMAGE NAME> > /home/save.tar
# load it back
docker load < /home/save.tar
A Docker container can be exported to a tarball and imported back again. This will not preserve the history of the container.
@pvgomes
pvgomes / Redis
Last active June 24, 2016 20:04
Redis Commads
### Remove multiple itens by pattern
redis-cli KEYS "prefix:*" | xargs redis-cli DEL
By conf
redis-cli -h 0.0.0.0 -p 6380 KEYS "*" | xargs redis-cli -h 0.0.0.0 -p 6380 DEL