Skip to content

Instantly share code, notes, and snippets.

View jayspeidell's full-sized avatar

Jay Speidell jayspeidell

View GitHub Profile
@jayspeidell
jayspeidell / binary_conversion_steps.py
Last active January 10, 2021 21:51
Step-by-step binary, dex, and decimal conversion
# This is a learning tool to illustrate the steps of converting from
# one number system to another.
# dec2hex(int) Convert a decimal number to hex step-by-step.
# dec2bin(int) Convert binary number to decimal step-by-step.
# bin2dec(string) Convert a binary fraction to a decimal fraction. 12 decimal places.
# bin2float(string) Convert a binary fraction to a decimal fraction with scientific notation.
# float2bin(float) Convert a decimal fraction to a binary fraction.
def low_scientific(n, pnt=True):
@jayspeidell
jayspeidell / kaggle_download.py
Last active July 18, 2023 12:23
Sample script to download Kaggle files
# Info on how to get your api key (kaggle.json) here: https://github.com/Kaggle/kaggle-api#api-credentials
!pip install kaggle
api_token = {"username":"USERNAME","key":"API_KEY"}
import json
import zipfile
import os
with open('/content/.kaggle/kaggle.json', 'w') as file:
json.dump(api_token, file)
!chmod 600 /content/.kaggle/kaggle.json
!kaggle config path -p /content