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
// Djb2 hash function | |
unsigned long hash(char *str) { | |
unsigned long hash = 5381; | |
int c; | |
while ((c = *str++)) | |
hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ | |
return hash % NUM_BUCKETS; | |
} |
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
/* | |
* This is free and unencumbered software released into the public domain. | |
* | |
* For more information, please refer to <https://unlicense.org> | |
*/ | |
//Regular text | |
#define BLK "\e[0;30m" | |
#define RED "\e[0;31m" | |
#define GRN "\e[0;32m" |
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 urllib.request import urlopen | |
from io import BytesIO | |
from zipfile import ZipFile | |
def download_and_unzip(url, extract_to='.'): | |
http_response = urlopen(url) | |
zipfile = ZipFile(BytesIO(http_response.read())) | |
zipfile.extractall(path=extract_to) |