This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$stty echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#In powershell, do this to load a file named "load_me.csv", get first 10000 lines, then output it to "test.csv" | |
powershell -command "& {Get-Content load_me.csv -TotalCount 10000" | Out-File test.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Highlight your text, do 'Command Shift L' to get multiple cursors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$split -l 1000000 data data. | |
# Will return files: data.aa, data.ab, data.ac, etc. each with the number of lines specified (one million in this case) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$sed -i '1d' file.csv # Remove the first line | |
$sed -i '2d' file.csv # Remove the second line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to view the docstring of a function quickly | |
# https://www.python.org/dev/peps/pep-0257/ | |
### View the docstring of a function | |
$print repr(foo.__doc__) # e.g. print repr(matplotlib.pyplot.plt.__doc__) | |
### Split the lines | |
$foo.__doc__.splitlines() # e.g. matplotlib.pyplot.plt.__doc__.splitlines() | |
### Trim any unnecessary lines - basically do this for best formatting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From https://csvkit.readthedocs.org | |
# Shows you stats about the file (e.g. col names, type, nulls, min, max, median, std deviation, unique values, most frequent) | |
$csvstat myfile.csv | |
# Peak at excel file to display in terminal | |
$in2csv myfile.xlsx | |
$in2csv myfile.xlsx > myfile.csv # can write xlsx file to csv by chaining operations | |
# Look at data, formats nicely with borders |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wc -l <myfile> # Example output: 4577465 myfile.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<!-- Load D3 from site --> | |
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script> | |
<!-- CSS (Styling) --> | |
<style type="text/css"> | |
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<!-- D3 Template, can run with: python -m SimpleHTTPServer 8000 | |
Reference: https://github.com/mbostock/d3/wiki/API-Reference | |
--> | |
<html> | |
<head> | |
<!-- Load D3 from site --> | |
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script> | |