Skip to content

Instantly share code, notes, and snippets.

@jcaristy
jcaristy / info.md
Last active September 24, 2017 14:33
[PySpark: Comandos] #python #pyspark

SparkContext

with pyspark.SparkContext("local", "PySparkWordCount") as sc: file_path = "example.csv"

Leer un TXT

data = sc.textFile(file_path)

data = sc.textFile(file_path).cache

@jcaristy
jcaristy / bash.sh
Last active September 23, 2017 02:30
[AWS: CLI] #aws #python
# http://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-crawler-pyspark-extensions-python-intro.html
pip install awscli --upgrade --user
source ~/.bash_profile
aws --version
@jcaristy
jcaristy / bash.sh
Last active September 23, 2017 02:15
[Python: Conda Comandos] #python
#Documentación
#https://conda.io/docs/user-guide/tasks/manage-environments.html
#Listar los enviroments
conda info --envs
conda env list
#Crear ambiente especificando la version de python
conda create -n myenv python=3.4
@jcaristy
jcaristy / info.md
Last active September 20, 2017 23:15
[RoR: Control Structures]

If

if Bollean

end

@jcaristy
jcaristy / info.md
Created September 20, 2017 23:06
[RoR: Ranges] #ruby
# Inclusive range
x = 1..10
# Exclusive range
x = 1...10

# Obtener el primero
x.begin
x.first
@jcaristy
jcaristy / info.md
Created September 20, 2017 22:28
[RoR: Symbols] #ruby

Symbols

Son como un String pero que solo se instancia una sola vez en memoria. La idea es que en los Hash siempre se utilicen Symbols y no Strings

# Ejemplo
hash_person = {:nombre => "Juan"}
hash_person[:Apellido] = "Aristizabal"
@jcaristy
jcaristy / info.md
Last active September 20, 2017 22:17
[RoR: Hashes] #ruby

Hashes

# Declarar
hash_person = {"nombre" => "Juan"}
hash_person["Apellido"] = "Aristizabal"

# Acceder
nombre = hash_person["nombre"]		# Por Key
index = hash_person.key("Juan") # Me devuelve el Key
@jcaristy
jcaristy / info.md
Created September 20, 2017 22:06
[RoR: Arrays] #ruby

Arrays

data_set = ['a','b','c']
data_set[0]
data_set[0] = 'a1'

# Agregar al final
data_set << 'd'
@jcaristy
jcaristy / conceptos.md
Last active September 20, 2017 22:57
[RoR: Conceptos Basicos] #ruby

Variables

  • Global : $var
  • Class : @@var
  • Instance : @var
  • Local : var
  • Block : var

Obtener tipo de objeto

@jcaristy
jcaristy / documentation.md
Created September 20, 2017 18:03
[RoR: Documentation] #ruby