Skip to content

Instantly share code, notes, and snippets.

@pragnesh
pragnesh / csv_splitter.py
Created August 16, 2022 07:54 — forked from jrivero/csv_splitter.py
A Python CSV splitter
import os
def split(filehandler, delimiter=',', row_limit=10000,
output_name_template='output_%s.csv', output_path='.', keep_headers=True):
"""
Splits a CSV file into multiple pieces.
A quick bastardization of the Python CSV library.
Arguments:
@pragnesh
pragnesh / redis-mass-insert.md
Created November 2, 2021 06:35 — forked from Squab/redis-mass-insert.md
Prepares data for Redis Mass Insertion with the redis-cli --pipe command

redis-mass-insertion

Lightweight Python script to prepare Redis commands for mass insertion.

Code

#!/usr/bin/env python
"""
    redis-mass.py
@pragnesh
pragnesh / mirror_remote_directory_to_local_directory
Created November 2, 2021 04:21 — forked from pixeline/mirror_remote_directory_to_local_directory
Bash script using lftp to mirror remote directory to local directory, thus keeping the local directory synchronized with the remote one.
#!/bin/sh
# @author: Alexandre Plennevaux
# @description: MIRROR DISTANT FOLDER TO LOCAL FOLDER VIA FTP
#
# FTP LOGIN
HOST='sftp://ftp.domain.com'
USER='ftpusername'
PASSWORD='ftppassword'
# DISTANT DIRECTORY
@pragnesh
pragnesh / codecommit and ec2 role.md
Created November 3, 2020 06:23 — forked from ddepaoli3/codecommit and ec2 role.md
How to use codecommit with IAM role without using IAM user credential
@pragnesh
pragnesh / sysctl.conf
Created November 22, 2018 04:32 — forked from voluntas/sysctl.conf
Sysctl configuration for high performance
### KERNEL TUNING ###
# Increase size of file handles and inode cache
fs.file-max = 2097152
# Do less swapping
vm.swappiness = 10
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2
@pragnesh
pragnesh / NASA_images_png2yuv
Created December 12, 2017 06:02 — forked from jesstess/NASA_images_png2yuv
Turning NASA images into movies: png2yuv | mpeg2enc
Keith gave me the hook-up on turning NASA images into a high-quality movie. I had tried twiddling knobs starting from a basic ffmpeg incant:
ffmpeg -r 10 -i frame%03d.jpg frames.mov
but the movies looked terrible.
Keith said:
"""
Generally if you're making a movie out of separate frames, I prefer to use png2yuv and mpeg2enc from the mjpegtools package instead of ffmpeg -- it's pretty clean code designed for this task instead of an assemblage of random libraries.
@pragnesh
pragnesh / EfficientThreadPoolExecutor
Created September 25, 2016 06:15 — forked from akshaydeo/EfficientThreadPoolExecutor
EfficientThreadPoolExecutor
/**
* Thread pool executor
* Author: akshay
* Date : 9/30/13
* Time : 2:55 PM
*/
public class EfficientThreadPoolExecutor extends ThreadPoolExecutor {
/**
* Logger
@pragnesh
pragnesh / Spark aggregateByKey
Last active August 22, 2016 05:55 — forked from tmcgrath/Spark aggregateByKey
Spark aggregateByKey example
Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/___/ .__/\_,_/_/ /_/\_\ version 1.1.0
/_/
Using Scala version 2.10.4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_65)
Type in expressions to have them evaluated.
Type :help for more information.
@pragnesh
pragnesh / nginx.conf
Last active July 14, 2016 10:16 — forked from jrom/nginx.conf
nginx hack for multiple conditions
if ($request_uri = /) {
set $test A;
}
if ($host ~* teambox.com) {
set $test "${test}B";
}
if ($http_cookie !~* "auth_token") {
set $test "${test}C";