Skip to content

Instantly share code, notes, and snippets.

View diogocapela's full-sized avatar

Diogo Capela diogocapela

View GitHub Profile
@diogocapela
diogocapela / Makefile
Created March 28, 2019 21:59
Makefile de LPROG (Genérico para macOS e Windows)
# Makefile for using flex with bison
#
# The executable receives the name of the current folder
# Do not use spaces in the name of the folder
#
# The .lex and .y files used are the first ones found by ls
#
# If there is a .txt file, it will be used as the input of the executable
#
# This Makefile works on Linux and on OSX
@diogocapela
diogocapela / Makefile
Created March 29, 2019 19:58
Makefile LPROG
# Makefile de exemplo de uso do flex
#
# O programa fica com o nome da pasta onde estamos
# Não usar espaços no nome!
#
# O ficheiro flex usado é o primeiro encontrado pelo ls
#
# Se existir um ficheiro .txt este será usado como standard input
# ao correr o programa
#
@diogocapela
diogocapela / Makefile
Created April 1, 2019 11:20
Exercício Moodle Aula LPROG
# Makefile for using flex with bison
#
# The executable receives the name of the current folder
# Do not use spaces in the name of the folder
#
# The .lex and .y files used are the first ones found by ls
#
# If there is a .txt file, it will be used as the input of the executable
#
# This Makefile works on Linux and on OSX
@diogocapela
diogocapela / random.c
Created April 17, 2019 15:36
Get Random Number in C
int getRandomIntBetween(int min, int max) {
srand(time(NULL) * getpid() << 16);
int randomNumber = (rand() % max) + min;
return randomNumber;
}
@diogocapela
diogocapela / main.c
Created April 17, 2019 17:51
Error: No such file or directory
#include <errno.h>
#include <fcntl.h>
#include <semaphore.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <errno.h>
#include <fcntl.h>
#include <pthread.h>
#include <semaphore.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
scrollbar-width: none;
overflow: -moz-scrollbars-none;
-ms-overflow-style: none;
&::-webkit-scrollbar {
display: none;
width: 0;
height: 0;
}
@diogocapela
diogocapela / keybase.md
Created November 27, 2019 16:46
keybase.md

Keybase proof

I hereby claim:

  • I am diogocapela on github.
  • I am diogocapela (https://keybase.io/diogocapela) on keybase.
  • I have a public key ASDq9CGecwsL3cNrUS3gOKPYdlW1lUoMWbFmSE1bSSyo6go

To claim this, I am signing this object:

@diogocapela
diogocapela / english-prefixes-list.txt
Created January 24, 2020 21:09
english-prefixes-list
ab
ad
an
ante
anti
auto
be
bi
centi
circum
@diogocapela
diogocapela / country-dial-codes.json
Created March 25, 2020 15:21
country-dial-codes.json
[
{ "name": "Afghanistan", "iso": "AF", "flag": "🇦🇫", "dialCode": "+93" },
{ "name": "Aland Islands", "iso": "AX", "flag": "🇦🇽", "dialCode": "+358-18" },
{ "name": "Albania", "iso": "AL", "flag": "🇦🇱", "dialCode": "+355" },
{ "name": "Algeria", "iso": "DZ", "flag": "🇩🇿", "dialCode": "+213" },
{ "name": "American Samoa", "iso": "AS", "flag": "🇦🇸", "dialCode": "+1-684" },
{ "name": "Andorra", "iso": "AD", "flag": "🇦🇩", "dialCode": "+376" },
{ "name": "Angola", "iso": "AO", "flag": "🇦🇴", "dialCode": "+244" },
{ "name": "Anguilla", "iso": "AI", "flag": "🇦🇮", "dialCode": "+1264" },
{ "name": "Antarctica", "iso": "AQ", "flag": "🇦🇶", "dialCode": "+672" },