Skip to content

Instantly share code, notes, and snippets.

View pvarsh's full-sized avatar

Peter Varshavsky pvarsh

View GitHub Profile
@pvarsh
pvarsh / .vimrc
Created February 6, 2019 19:19
.vimrc
"""" Basic Behavior
set number " show line numbers
set relativenumber " show relative line numbers
set wrap " wrap lines
set encoding=utf-8 " set encoding to UTF-8 (default was "latin1")
set lazyredraw " redraw screen only when we need to
set showmatch " highlight matching parentheses / brackets [{()}]
set laststatus=2 " always show statusline (even with only single window)
set ruler " show line and column number of the cursor on right side of statusline
Name Age
Jesus 2016
@pvarsh
pvarsh / .bashrc
Created December 22, 2015 13:55
CSV Row Count
alias csvrowcount='for i in `find . -name "*.csv"`; do echo "$i"; csvstat --count $i; done'
alias csvfilecount='find . -name "*.csv" | wc -l'
@pvarsh
pvarsh / csv_decorator.py
Created November 20, 2015 01:25
Decorator: csv reader
import csv
import string
def make_csv():
with open('data.csv', 'wb') as fh:
writer = csv.writer(fh)
for i in range(10):
writer.writerow([i, string.lowercase[i:i+5]])
def process_line(line):
@pvarsh
pvarsh / .vimrc
Last active August 29, 2015 14:21
My rcs
" Syntax highlighting
syntax on
filetype indent plugin on
" ghlight lines over 79 columns (PEP8)
highlight OverLength ctermbg=red ctermfg=white guibg=#351818
match OverLength /\%79v.\+/
" Convert tabs to 4 spaces
set tabstop=4
### Removes all rows that are identically ''
import parsekit
class FilterEmptyRows(parsekit.Step):
def run(self, record, metadata):
criterion = {'', None}
if not set(record).issubset(criterion):
return record, metadata
from datetime import datetime
import parsekit
class FilterRows(parsekit.Step):
start_row = parsekit.Argument(
"The row to start emitting from.",
required=True,
type=int)
import parsekit
class FilterEmptyRows(parsekit.Step):
def run(self, record, metadata):
criterion = {'', None}
if not set(record).issubset(criterion):
return record, metadata
import parsekit
class FilterRow(parsekit.Step):
start_row = parsekit.Argument(
"The row to start emitting from.",
required=True,
type=int)
def configure(self, options):
@pvarsh
pvarsh / emptry_row_types_peter_1
Created February 20, 2015 19:12
Empty row types: Peter
## Illinois: skip header rows
## Maine: skipped rows containing only '' or None
## Utah: skip empty rows, skip rows containing certain data in certain column. Specifically the footer row started with the date in first column, so it was filtered out by parsing first column as a date.
## Washington: removed rows that were identically '' from end of file