Skip to content

Instantly share code, notes, and snippets.

View VinACE's full-sized avatar
💭
I may be slow to respond.

VinACE

💭
I may be slow to respond.
View GitHub Profile
@VinACE
VinACE / pyspark_interactive_with_datastax_connector.py
Created November 25, 2016 07:10 — forked from spaceshipoperator/pyspark_interactive_with_datastax_connector.py
after successfully doing this http://planetcassandra.org/blog/kindling-an-introduction-to-spark-with-cassandra/ with spark-shell, one might reasonably think that the following would work....though I may be missing something trivial.
## invoking pyspark as follows: ##
# /path/to/spark-1.2.0-bin-hadoop2.4/bin/pyspark --jars /path/to/spark-1.2.0-bin-hadoop2.4/jars/spark-cassandra-connector-assembly-1.2.0-SNAPSHOT.jar
# first, stop the spark context launched by pyspark to avoid the conflict
sc.stop()
from py4j.java_gateway import java_import
from pyspark import SparkConf
conf = (SparkConf()
.setMaster("local")
@VinACE
VinACE / df2json.py
Created November 28, 2016 07:27 — forked from mikedewar/df2json.py
A little script to convert a pandas data frame to a JSON object. Is there a better way?
"""
tiny script to convert a pandas data frame into a JSON object
"""
import ujson as json
import pandas
import numpy as np
df = pandas.DataFrame({
"time" : [1,2,3,4,5],
@VinACE
VinACE / INSTALL
Created August 4, 2017 10:57 — forked from arya-oss/INSTALL.md
Ubuntu 16.04 Developer Tools installation
###### development tools
sudo apt-get install build-essential python-dev git nodejs-legacy npm gnome-tweak-tool openjdk-8-jdk
### Python packages
sudo apt-get install python-pip python-virtualenv python-numpy python-matplotlib
### pip packages
pip install django flask django-widget-tweaks django-ckeditor beautifulsoup4 requests classifier SymPy ipython
@VinACE
VinACE / world-index.json
Created November 2, 2017 14:32 — forked from sanaulla123/world-index.json
Index mapping structure for world index
{
"aliases":{},
"warmers":{},
"mappings": {
"world": {
"properties": {
"capital": {
"properties": {
"district": {
"type": "string"
@VinACE
VinACE / csv_to_elastic_search_bulk_insert.py
Created November 2, 2017 15:16 — forked from clemsos/csv_to_elastic_search_bulk_insert.py
Elastic Search : index large csv files with Python Pandas
from pyelasticsearch import ElasticSearch
import pandas as pd
from time import time
root_path="/home/clemsos/Dev/mitras/"
raw_data_path=root_path+"data/"
csv_filename="week10.csv"
t0=time()
@VinACE
VinACE / useful_pandas_snippets.py
Last active September 3, 2018 06:38 — forked from bsweger/useful_pandas_snippets.md
Useful Pandas Snippets
# multiply/divide
df['quantity'] = df['quantity'].apply(lambda x: x*-1)
# round function on dataframe
df['quantity'] = df['quantity'].apply(lambda x: round(x, 2))
# List unique values in a DataFrame column
# h/t @makmanalp for the updated syntax!
df['Column Name'].unique()
'''This script goes along the blog post
"Building powerful image classification models using very little data"
from blog.keras.io.
It uses data that can be downloaded at:
https://www.kaggle.com/c/dogs-vs-cats/data
In our setup, we:
- created a data/ folder
- created train/ and validation/ subfolders inside data/
- created cats/ and dogs/ subfolders inside train/ and validation/
- put the cat pictures index 0-999 in data/train/cats
'''This script goes along the blog post
"Building powerful image classification models using very little data"
from blog.keras.io.
It uses data that can be downloaded at:
https://www.kaggle.com/c/dogs-vs-cats/data
In our setup, we:
- created a data/ folder
- created train/ and validation/ subfolders inside data/
- created cats/ and dogs/ subfolders inside train/ and validation/
- put the cat pictures index 0-999 in data/train/cats
@VinACE
VinACE / classifier_from_little_data_script_3.py
Created June 11, 2018 01:30 — forked from fchollet/classifier_from_little_data_script_3.py
Fine-tuning a Keras model. Updated to the Keras 2.0 API.
'''This script goes along the blog post
"Building powerful image classification models using very little data"
from blog.keras.io.
It uses data that can be downloaded at:
https://www.kaggle.com/c/dogs-vs-cats/data
In our setup, we:
- created a data/ folder
- created train/ and validation/ subfolders inside data/
- created cats/ and dogs/ subfolders inside train/ and validation/
- put the cat pictures index 0-999 in data/train/cats
@VinACE
VinACE / docker_cheat_sheet.sh
Created June 16, 2018 05:36 — forked from victorhcm/docker_cheat_sheet.sh
(small) docker cheat sheet
#################################################################################
# Authors: Keiller Nogueira, Victor de Melo
#################################################################################
# nvidia-docker seems more stable now and several images are starting to adopt it (including
# [kaixhin](https://github.com/NVIDIA/nvidia-docker/issues/85).
# hence, we suggest to use it instead, as it solves a few issues with gpu passthrough.
# usage: it is only required when creating a container, i.e, with `run` and related arguments
# you're not required to provide $DOCKER_NVIDIA_DEVICES as it will find the devices itself