This file contains hidden or 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
| // REFERENCE ONLY, DOES NOT WORK | |
| import * as d3 from 'd3' | |
| // Prepare canvas | |
| const m = { left: 50, right: 50, top: 50, bottom: 50 } | |
| const w = 900 - m.left - m.right | |
| const h = 600 - m.top - m.bottom | |
| const svg = d3.select('#canvas-scatter') |
This file contains hidden or 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
| // REFERENCE ONLY, DOES NOT WORK | |
| import * as d3 from 'd3' | |
| const m = {left: 100, right: 50, top: 50, bottom: 100} | |
| const w = 900 - m.left - m.right | |
| const h = 600 - m.top - m.bottom | |
| let time = 0 |
This file contains hidden or 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
| /* Basic reset */ | |
| *, *::before, *::after { | |
| margin: 0; | |
| padding: 0; | |
| box-sizing: border-box; | |
| } | |
| html { | |
| font-size: 62.5%; |
This file contains hidden or 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
| import os | |
| import glob | |
| PATH = '/path/to/files' | |
| def main(path: str): | |
| files = glob.glob(f'{path}/*') | |
| for file in files: | |
| os.rename(file, file.lower()) |
This file contains hidden or 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
| """Copies a list of images from one folder from another and renames | |
| it using the 'datetime-original' field from exif spec. For images | |
| without 'datetime-original', we generate a random id.""" | |
| import os | |
| import glob | |
| import uuid | |
| import shutil | |
| from datetime import datetime | |
| from exif import Image |
This file contains hidden or 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
| -- FILL TABLE FROM CSV FILE | |
| COPY table_name FROM '/path/to/file.csv' WITH CSV; |
This file contains hidden or 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
| """COLLECTION OF CODE SNIPPETS. CHEAT SHEET.""" | |
| import numpy as np | |
| """PANDAS CONFIG""" | |
| import pandas as pd | |
| # set maximum rows/columns to be printed | |
| pd.options.display.max_rows = 999 | |
| pd.options.display.max_columns = 99 |
This file contains hidden or 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
| # make all files in current directory lowercase | |
| for file in * ; do mv $file ${file:l} ; done | |
| # activate env variables in .env file | |
| export $(grep -v '^#' .env | xargs) | |
| # python virtual environments | |
| ## create | |
| virtualenv --python=python3.6 $HOME/venv/my-env | |
| ## activate |