Skip to content

Instantly share code, notes, and snippets.

View winterrdog's full-sized avatar
🏠
Busy busting SIGSEGV bugs

winterrdog winterrdog

🏠
Busy busting SIGSEGV bugs
  • No_such_file_or_directory
  • Earth realm
  • 20:39 (UTC +03:00)
View GitHub Profile
@hantoine
hantoine / download_and_unzip.py
Last active October 27, 2024 04:10
Download and extract a ZIP file in Python
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)
@RabaDabaDoba
RabaDabaDoba / ANSI-color-codes.h
Last active November 18, 2024 07:43 — forked from iamnewton/bash-colors.md
The entire table of ANSI color codes working in C!
/*
* 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"
// 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;
}