Skip to content

Instantly share code, notes, and snippets.

View avinash-mishra's full-sized avatar
🎯
Focusing

Avinash avinash-mishra

🎯
Focusing
View GitHub Profile
@erincerys
erincerys / mysql2cassandra.py
Created March 26, 2014 17:20
Dumps a MySQL table and reformulates it into JSON to be ingested into a Cassandra table
#! /usr/bin/env python
#
# mysql2cassandra.py
# Dump a MySQL result set to file and then import into a Cassandra column family
#
# Configuration
# mysql_params [host, port, user, password, db] MySQL conenction parameters
# mysql_columns [colname, colname2, ...] Columns for building MySQL query
# The column that will hold values of the row key in the Cassandra column family must be first
@avinash-mishra
avinash-mishra / mysql2cassandra.py
Created September 23, 2016 09:22 — forked from erincerys/mysql2cassandra.py
Dumps a MySQL table and reformulates it into JSON to be ingested into a Cassandra table
#! /usr/bin/env python
#
# mysql2cassandra.py
# Dump a MySQL result set to file and then import into a Cassandra column family
#
# Configuration
# mysql_params [host, port, user, password, db] MySQL conenction parameters
# mysql_columns [colname, colname2, ...] Columns for building MySQL query
# The column that will hold values of the row key in the Cassandra column family must be first
@abachman
abachman / notes.md
Created February 7, 2017 19:05
Cassandra data modeling notes

Based on http://datascale.io/cassandra-partitioning-and-clustering-keys-explained/

Primary Keys

A single column Primary Key is also called a Partition Key.

When Cassandra is deciding where in the cluster to store this particular piece of data, it will hash the partition key. The value of that hash dictates where the data will reside and which replicas will be responsible for it.

package org.insidion.test.jsoupexperiment;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
@kennethzfeng
kennethzfeng / walk.py
Created March 28, 2014 05:30
Demo on Python's os module's walk function
#!/usr/bin/python
import os
def walk(dir):
for (root, dirs, files) in os.walk(dir):
for file in files:
path = os.path.join(root, file)
print(repr(path))
if __name__ == "__main__":
@avinash-mishra
avinash-mishra / AWS-CLI.md
Last active September 10, 2018 08:02 — forked from stevenyap/AWS-CLI.md
AWS S3 Command Line

S3 Syncing

# sync from bucket to local
aws s3 sync <bucket> <target_folder> <options>
aws s3 sync s3://mybucket . --acl public-read

aws s3 sync --region ap-northeast-1 s3://[移動元バケット名] s3://[移動先バケット名]
@marcelcaraciolo
marcelcaraciolo / tf_idf_final.py
Created January 13, 2012 03:38
tf-idf example
#-*- coding: utf-8 -*-
import re
import nltk
from nltk.tokenize import RegexpTokenizer
from nltk import bigrams, trigrams
import math
stopwords = nltk.corpus.stopwords.words('portuguese')
@hartfordfive
hartfordfive / aws-ssh.py
Last active December 21, 2018 12:48
Sample python script to SSH into EC2 instances by hostname tag
#!/usr/bin/env python
import sys, subprocess, json, os
from pprint import pprint
if __name__ == "__main__":
if 'AWS_SSH_KEY_FILE' in os.environ:
key_path = os.environ['AWS_SSH_KEY_FILE']
else:
@kakakaya
kakakaya / output.txt
Created March 14, 2018 10:09
markovify example
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
@zhreshold
zhreshold / check_platform.py
Last active May 30, 2019 14:39
Check OS/Python/Cpu Info and Network connections
"""Diagnose script for checking OS/hardware/python/pip/mxnet/network.
The output of this script can be a very good hint to issue/problem.
"""
import platform, subprocess, sys, os
import socket, time
try:
from urllib.request import urlopen
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse