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
from __future__ import annotations | |
import requests | |
import datetime | |
def main() -> int: | |
headers = { | |
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:129.0) Gecko/20100101 Firefox/129.0', | |
'Accept': 'application/json, text/plain, */*', | |
'Content-Type': 'application/json', |
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
#!/usr/bin/env bash | |
set -euxo pipefail | |
python -c 'import pkgutil;print([x[1] for x in list(pkgutil.iter_modules())])' |
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
gg -> takes you to the top of the file | |
G -> takes you to the bottom of the file | |
{ -> goes down (skip) down a block of code | |
} -> goes up (skip) down a block of code | |
(Number) (command) -> will do that command that many times. | |
Example 50 } -> will take you down 50 blocks. | |
Example 50 { -> will take you up 50 blocks. | |
:(line-number) go to a specific line | |
Example :30 -> will take you to 30th line |
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
git commit --date="1 day ago" -m "I commited yesterday, I swear" |
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
# wget https://raw.githubusercontent.com/{org}/{repo}/{branch}/{filepath.../...} | |
# Example: (as different filename .gitignore) | |
wget https://raw.githubusercontent.com/github/gitignore/main/Python.gitignore -O .gitignore |
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
echo "curl -s https://api.github.com/octocat" >> ~/.bash_profile |
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
#!/bin/bash | |
MAC_copy(){ | |
cat | pbcopy | |
} | |
MAC_paste(){ | |
pbpaste | |
} |
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
k_in_knn_value, number_of_vectors, from_vector, to_vector, euclidean_distance_df = get_input() | |
knn_obj = KNearestNeighborsAlgorithm(_k_in_knn_value=k_in_knn_value, _euclidean_distance_df=euclidean_distance_df) | |
knn_distance = knn_obj.execute() | |
print(f""" | |
>> {k_in_knn_value}-Nearest-Neighbours are: {knn_distance.head(k_in_knn_value).Label.tolist()} | |
>> Most Common Label is: {most_common(knn_distance.head(k_in_knn_value).Label.tolist())} | |
""") |
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
def compute_euclidean_distance(self): | |
return math.sqrt( | |
sum( | |
[(i - j) ** 2 for i, j in zip(self.from_vector_list, self.to_vector_list)] | |
) | |
) |