Skip to content

Instantly share code, notes, and snippets.

@ZeccaLehn
ZeccaLehn / InternationalCallingCodeToLatLong.csv
Created October 26, 2024 13:54
International Calling Codes To Latitude and Longitude
Country Calling Code Latitude Longitude
Afghanistan 93 33.93911 67.709953
Albania 355 41.153332 20.168331
Algeria 213 28.033886 1.659626
Andorra 376 42.546245 1.601554
Angola 244 -11.202692 17.873887
Antigua and Barbuda +1 268 17.060816 -61.796428
Argentina 54 -38.416097 -63.616672
Armenia 374 40.069099 45.038189
Australia 61 -25.274398 133.775136
@ZeccaLehn
ZeccaLehn / RTencrypt.txt
Created July 9, 2023 06:38
Round Trip Encryption w/Python
pip install cryptography
-----------------
from cryptography.fernet import Fernet
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
import base64
import os
@ZeccaLehn
ZeccaLehn / csv_jupyter.py
Last active January 18, 2020 03:48
CSV Download and Upload Collab Jupyter Python
## Download
from google.colab import files
df.to_csv('df.csv')
files.download('df.csv')
## Upload
from google.colab import files
df = files.upload()
## Save CSV on remotely in Colab
@ZeccaLehn
ZeccaLehn / SP500.csv
Created October 28, 2019 00:58
S&P500 CSV Tickers
Symbol Name Sector
MMM 3M Company Industrials
AOS A.O. Smith Corp Industrials
ABT Abbott Laboratories Health Care
ABBV AbbVie Inc. Health Care
ACN Accenture plc Information Technology
ATVI Activision Blizzard Information Technology
AYI Acuity Brands Inc Industrials
ADBE Adobe Systems Inc Information Technology
AAP Advance Auto Parts Consumer Discretionary
@ZeccaLehn
ZeccaLehn / microVC.csv
Created October 6, 2019 21:06
Micro VC CSV
Firm Name Investment Sector Location (City) Investment Stage URL
1776 Technology, Health, Transportation, Energy, Education Washington, D.C. Early Stage Venture, Seed https://www.1776.vc/
11.2 Capital Healthcare, Security, Finance San Francisco, CA Early Stage, Seed http://www.112capital.com/
122 West Ventures Information Technology, Telecoms, Media, and Communications San Francisco, CA Early Stage 122west.vc/
1517 Fund Clean Technology, Consumer Discretionary, Healthcare, Industrials, Information Technology, Telecoms, Media, and Communications San Francisco, CA Early Stage: Seed, Early Stage: Start-up www.1517fund.com
1confirmation Financial Services San Francisco, CA Early Stage Venture, Seed www.1confirmation.com
3Rodeo Business Services, Information Technology, Telecoms, Media, and Communications Los Angeles, CA Early Stage, Early Stage: Seed www.3rodeo.com
4490 Ventures Technology, Financial Services, Agriculture, Education Madison, WI Early Stage Venture, Seed http:
@ZeccaLehn
ZeccaLehn / socialExtract.py
Last active October 6, 2019 04:02
Get all social links / emails from HTML site
from urllib.request import urlopen
from bs4 import BeautifulSoup
import pandas as pd
import random
from urllib.parse import urlparse
import urllib.request
import lxml.html
# randLink = str(seedFunds.iloc[int(random.uniform(1, len(seedFunds))), 4])
@ZeccaLehn
ZeccaLehn / boxplotPython.py
Created July 17, 2019 21:38
Boxplot Python
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
data = pd.read_csv('Stages.csv').dropna()
x = "Stage"
y = "Experimental"
plt.figure(figsize=(15,16))
@ZeccaLehn
ZeccaLehn / pageHrefs.txt
Last active April 26, 2019 15:54
CSV Download from document withing Javascript JS
var allDeals = document.getElementsByClassName('u-uncoloredLink js-syndicate_click');
var links = []
for (var i=0; i < allDeals.length; i++) {
links.push(allDeals[i].getAttribute('data-url'));
};
var csvContent = "data:text/csv;charset=utf-8,";
links.forEach(function(rowArray){
csvContent += rowArray + "\r\n";
@ZeccaLehn
ZeccaLehn / pythonzip.py
Created April 5, 2019 17:47
Read Zip into Python from URL
import requests, zipfile, io
url = 'https://www.huduser.gov/portal/datasets/hads/hads2013n_ASCII.zip'
filename = 'thads2013n.txt'
r = requests.get(url)
z = zipfile.ZipFile(io.BytesIO(r.content))
z.extractall()
import pandas as pd
@ZeccaLehn
ZeccaLehn / csvFromJupyter.py
Last active March 7, 2019 00:11
Download CSVs Directly from JupyterNotebook or Google DataLab
import pandas as pd
from IPython.display import FileLinks # FileLink
import os
data = pd.DataFrame([['a', 'b'],['c', 'd'],['e','f']], columns = ['foo', 'bar']) # .values.tolist()
directory = 'testdata/'
filename = 'data2.csv'
pathtofile = directory + filename
if not os.path.exists(directory):