Skip to content

Instantly share code, notes, and snippets.

ilovefood2 / redis_import_csv.txt
Created September 20, 2019 06:32 — forked from arsperger/redis_import_csv.txt
import csv file into redis with a single command
cat data.csv | awk -F',' '{print " SET \""$1"\" \""$2"\" \n"}' | redis-cli --pipe
ilovefood2 /
Created September 14, 2019 18:09 — forked from iyvinjose/
Read large files line by line without loading entire file to memory. Supports files of GB size
def read_lines_from_file_as_data_chunks(file_name, chunk_size, callback, return_whole_chunk=False):
read file line by line regardless of its size
:param file_name: absolute path of file to read
:param chunk_size: size of data to be read at at time
:param callback: callback method, prototype ----> def callback(data, eof, file_name)
def read_in_chunks(file_obj, chunk_size=5000):
ilovefood2 /
Last active July 4, 2019 04:19 — forked from patrickgill/
download m3u8 ts segments, then decode, join, and remux them! (HTTP Live Streaming TS files)
# download
aria2c -x 4 -j 4 -Z -P[000-286].ts
# decode (example)
#openssl aes-128-cbc -d -K 15D0F46608409DA364E3F5D92BDE9F61 -iv 00000000000000000000000000000000 -nosalt -in G00000000.ts -out G00000000.d.ts
# join all ts files
cat *.ts > out.ts
ilovefood2 /
Created April 21, 2019 08:11 — forked from kaleksandrov/
Simple script that starts and stops on Mac OSX.
case $# in
echo "Usage: $0 {start|stop}"
exit 1
case $1 in
ilovefood2 / hadoop_spark_osx
Created March 24, 2019 07:20 — forked from cjzamora/hadoop_spark_osx
Hadoop + Spark installation (OSX)
This post builds on the previous setup Hadoop (v1) guide, to explain how to setup a single node Hadoop (v2) cluster with Spark (v1) on OSX (10.9.5).
Apache Hadoop is a framework that allows for the distributed processing of large data sets across clusters of computers using simple programming models. It is designed to scale up from single servers to thousands of machines, each offering local computation and storage. Rather than rely on hardware to deliver high-availability, the library itself is designed to detect and handle failures at the application layer, so delivering a highly-available service on top of a cluster of computers, each of which may be prone to failures. The Apache Hadoop framework is composed of the following core modules:
HDFS (Distributed File System): a distributed file-system that stores data on commodity machines, providing very high aggregate bandwidth across the cluster.