Skip to content

Instantly share code, notes, and snippets.

@ngoodger
ngoodger / split_csv.py
Created August 27, 2017 03:31
Split csv file into a user specified number of smaller csv files. Example: python3 split_csv.py measurement_by_imsi_cell_2017-07-22_v4.csv 5
import argparse
def main(input_csv, file_count):
with open(input_csv, "r") as f:
csv_text = f.readlines()
header_line = csv_text[0]
body_lines = csv_text[1:]
line_count = len(body_lines)
lines_per_file = int(line_count / output_file_count)
# First file should take extra lines
@ngoodger
ngoodger / tmux_local_install.sh
Created July 27, 2017 10:12 — forked from ryin/tmux_local_install.sh
bash script for installing tmux without root access
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=2.5