Skip to content

Instantly share code, notes, and snippets.

View zerolx's full-sized avatar
🕶️
Working on Gitlab

zerolx zerolx

🕶️
Working on Gitlab
View GitHub Profile
@zerolx
zerolx / locadora.c
Last active January 30, 2020 03:17
Exercício em C que fiz pra outra pessoa sobre uma locadora, besteirinha
/*
Locadora
* Exercicio Reduzido
* Armazenamento em memória
* Apenas dados
Compilação normal com GCC
gcc locadora.c
*/
@zerolx
zerolx / main.c
Created May 8, 2017 20:39
Variable type discover in C99 way without _generic with just a simple macro
//Includes for the types and the I/O of main function
#include <stdio.h>
#include <stddef.h>
#include <stdint.h>
// The type discovery macro
#define typename(x) (__builtin_types_compatible_p(__typeof__(x), long int)) ? "long int" : \
(__builtin_types_compatible_p(__typeof__(x), char *)) ? "pointer to char" : \
(__builtin_types_compatible_p(__typeof__(x), char)) ? "char" : \
(__builtin_types_compatible_p(__typeof__(x), _Bool)) ? "_Bool" : \
@zerolx
zerolx / man_bypass_timeouts_.sh
Last active March 30, 2020 14:55
How to download from Amazon/Github without stress with timeouts
# Some servers like Amazon (Github use Amazon) set timeout limits to downloads
# If you must download some big file (lets say 500mb) you will be kicked out in middle of download
# That will always happen, blocking you from download.
# To work around this problem you will only need a program that listem for timeouts and can continuate where stops
# I will use Wget (linux) for that
wget -c -O <filename to write> --read-timeout=10 <url>
# -c tells wget to continue where stops
# -O tells wget to write the contents to file specified