Skip to content

Instantly share code, notes, and snippets.

View winterrdog's full-sized avatar
🏠
Found SIGSEGV at 0x7ffff09beef

winterrdog winterrdog

🏠
Found SIGSEGV at 0x7ffff09beef
  • No_such_file_or_directory
  • Earth realm
  • 08:24 (UTC +03:00)
View GitHub Profile
@hantoine
hantoine / download_and_unzip.py
Last active November 22, 2023 06:25
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 July 20, 2024 00:58 — 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;
}