Skip to content

Instantly share code, notes, and snippets.

View fernandojunior's full-sized avatar

Fernando Felix fernandojunior

  • Brazil
View GitHub Profile
@fernandojunior
fernandojunior / gist:9872d83117c5e7fbfcdb
Last active December 28, 2015 20:03
Class name using method in python
class Manager(object):
def __init__(self, cls_):
self.cls_ = cls_
def all(self):
print(self.cls_.__name__)
class Model(object):
@classmethod
@fernandojunior
fernandojunior / gist:be62cd40acf834f85a1f
Last active December 28, 2015 20:04
Class name using property in python
class Manager(object):
def __init__(self, cls_):
self.cls_ = cls_
def all(self):
print(self.cls_.__name__)
class Model(object):
http://blog.smartbear.com/web-monitoring/why-containers-instead-of-hypervisors/
http://stackoverflow.com/questions/20578039/difference-between-kvm-and-lxc
https://ofirm.wordpress.com/2014/01/05/creating-a-virtualized-fully-distributed-hadoop-cluster-using-linux-containers/
https://www.youtube.com/watch?v=0cDj7citEjE
@fernandojunior
fernandojunior / gist:2f014c2f7ffa4adc03ed
Last active November 24, 2015 18:28
Virtualbox internal network
vboxmanage dhcpserver add --netname intnet --ip 192.168.1.1 --netmask 255.255.255.0 --lowerip 192.168.1.2 --upperip 192.168.1.10 --enable
vboxmanage dhcpserver add --netname intnet --ip 10.10.10.1 --netmask 255.255.255.0 --lowerip 10.10.10.2 --upperip 10.10.10.10 --enable
vboxmanage dhcpserver remove --netname intnet
# ref
# https://www.virtualbox.org/manual/ch06.html
# https://www.virtualbox.org/manual/ch08.html#vboxmanage-dhcpserver
# https://www.youtube.com/watch?v=lhOY-KilEeE
@fernandojunior
fernandojunior / gist:13196c844ce084004455
Last active May 3, 2016 21:04
timestamp to datetime in python
>>> import datetime
>>> matchCreation = 1421845413033 # timestamp em milisegundos
>>> datetime.datetime.fromtimestamp(matchCreation / 1e3).strftime('%Y-%m-%d %H:%M:%S')
'2015-01-21 10:03:33'
>>> import datetime, time
>>> t = datetime.datetime(2015, 12, 10, 1, 51, 16)
>>> timestamp = time.mktime(t.timetuple()) # converve datetime para timestamp em segundos ...
>>> timestamp
@fernandojunior
fernandojunior / gist:1231cba3325cdca6239d
Last active December 2, 2016 02:55
mongo + hadoop
# instalacao do python, setup_tools, pip, virtualenv
# https://www.digitalocean.com/community/tutorials/how-to-set-up-python-2-7-6-and-3-3-3-on-centos-6-4
yum -y update
yum groupinstall -y development
yum install -y zlib-dev openssl-devel sqlite-devel bzip2-devel
yum install xz-libs
wget https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
wget https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tar.xz
@fernandojunior
fernandojunior / gist:35d3b17e4fbd4665f4be
Last active November 26, 2015 19:15
install hadoop 2.6
# Primeira parte: Instalacao do hadoop em standalone mode
# criacao do usuario
addgroup node # cria grupo node
adduser --ingroup node node # cria usuário node dentro do grupo node
su - node # trocar para usuario node
# atualizacao do sistema
sudo apt-get update
sudo apt-get upgrade
@fernandojunior
fernandojunior / gist:8c7bfc720e51f69645da
Last active November 24, 2015 07:16
mongoDB & Python
# http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
# https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-14-04
# https://docs.mongodb.org/getting-started/python/
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
# or
https://atom.io/
http://www.marinamele.com/install-and-configure-atom-editor-for-python
@fernandojunior
fernandojunior / gist:dc403ba5b775e7afe294
Last active September 14, 2015 15:18
RESTful Services with Java
## Libs:
- JAX-RS / Jersey - RESTful Web Services framework
- Gradle - OPEN SOURCE BUILD AUTOMATION dependencies manager
- CDI / Weld - Dependency Injection
# Storege & analytics
- Hadoop - Distributed storage and distributed processing of very large data
- Hive - data warehouse infrastructure built on top of Hadoop for providing data summarization, query, and analysis
- In-memory MPP-based Analytical Databases