Skip to content

Instantly share code, notes, and snippets.

View rtancman's full-sized avatar
🙏
🏊🏽

Raffael Tancman rtancman

🙏
🏊🏽
View GitHub Profile
from urllib.request import urlopen
from urllib.error import HTTPError
from bs4 import BeautifulSoup
def getDescription(url):
try:
html = urlopen(url)
except HTTPError as e:
return None
try:
@rtancman
rtancman / Dockerfile
Last active April 25, 2019 01:22
Python + Lambda - Otimizando o processo com Makefile
FROM amazonlinux
RUN yum update -y
RUN yum groupinstall "Development Tools" -y
RUN yum install -y \
gcc \
bzip2-devel \
libffi \
openssl-devel \
perl-core \
@rtancman
rtancman / 1) Dockerfile
Last active February 7, 2019 23:47
Python install depencies for AWS Lambda with Amazon Linux AMI
FROM amazonlinux
RUN yum update -y
RUN yum groupinstall "Development Tools" -y
RUN yum install -y \
gcc \
bzip2-devel \
libffi \
openssl-devel \
perl-core \
# Criando a estrutura inicial:
apex init
# Alterando estrutura para rodar python
# Executando o deploy
apex deploy
# Listando as funcoes
apex list
mkdir lambda_com_pacotes && cd lambda_com_pacotes
#criando o arquivo main.py
echo -e "
import requests
def handle(event, context):
r = requests.get('https://api.github.com/events')
return {
@rtancman
rtancman / aws-lambdas-python.sh
Last active February 3, 2019 21:02
Comandos para criar/editar/listar/remover um lambda utilizando o awscli
echo -e "
def handler(event, context):
return {
'texto': 'hello world lambda usando awscli',
}
" >> main.py
zip -qr awsclicreatelambda.zip main.py
aws lambda create-function \
@rtancman
rtancman / get-element-styles.js
Created November 5, 2018 15:28
show elements computed style
window.getComputedStyle = window.getComputedStyle || function( element ) {
return element.currentStyle;
}
//https://stackoverflow.com/questions/22907735/get-the-computed-style-and-omit-defaults
function getStylesWithoutDefaults( element ) {
var dummy = document.createElement(element.tagName);
document.body.appendChild( dummy );
var defaultStyles = getComputedStyle( dummy );
var elementStyles = getComputedStyle( element );
@rtancman
rtancman / async_psycopg2.py
Created April 17, 2018 16:55 — forked from FSX/async_psycopg2.py
A module for asynchronous PostgreSQL queries in Tornado.
#!/usr/bin/env python
__author__ = 'Frank Smit <frank@61924.nl>'
__version__ = '0.1.0'
import functools
import psycopg2
from tornado.ioloop import IOLoop, PeriodicCallback
@rtancman
rtancman / install_sublime_text.sh
Last active November 28, 2016 14:01 — forked from simonewebdesign/install_sublime_text.sh
Install Sublime Text 3 on Linux via POSIX shell script - http://simonewebdesign.it/install-sublime-text-3-on-linux/
#!/bin/sh
# Sublime Text 3 install with Package Control (last update: 25 September 2016)
#
# No need to download this script, just run it on your terminal:
#
# $ curl -L git.io/sublimetext | sh
# Detect the architecture
#!/bin/sh
# meetfranz
wget --max-redirect=10 -O Franz-linux-x64.tgz http://bit.ly/1UoL5es
mkdir -p /opt/meetfranz
tar zxvf Franz-linux-x64.tgz -C /opt/meetfranz
rm -rf Franz-linux-x64.tgz
# Add to applications list (thanks 4ndrej)
echo -e '' >> /opt/meetfranz/meetfranz.desktop;