Skip to content

Instantly share code, notes, and snippets.

View AndreFCruz's full-sized avatar
💻
Meeting deadlines

André Cruz AndreFCruz

💻
Meeting deadlines
View GitHub Profile
@AndreFCruz
AndreFCruz / caffeine.lua
Last active January 23, 2017 14:21
My Hammerspoon Configuration
local obj = {}
obj.__index = obj
obj.menuBarItem = nil
function obj:start()
self.menuBarItem = hs.menubar.new()
self.menuBarItem:setClickCallback(self.clicked)
self.setDisplay(hs.caffeinate.get("displayIdle"))
#include <stdio.h>
#include <string.h>
int main() {
int i;
for (i = 0; i < 108; i++) {
printf("%d. %s\n", i, strerror(i));
}
@AndreFCruz
AndreFCruz / dp.cpp
Last active June 22, 2017 09:31
algorithms for placing billboards along a highway with intervals >= 5, using DP or greedy techniques
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#define ARRAYSIZE(a) (sizeof(a))/(sizeof(a[0]))
using namespace std;
template <class T>
@AndreFCruz
AndreFCruz / TicTacToe.py
Created September 15, 2017 21:43
TicTacToe - MiniMax AI based on a scoring matrix of the game tree
'''
TicTacToe Game
Console based.
MiniMax AI based on a scoring matrix of the game tree
Python 2.7.9 - 32 bit
@author Andre Cruz
'''
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// Choose either "stable" for receiving highly polished,
// or "canary" for less polished but more frequent updates
updateChannel: 'stable',
@AndreFCruz
AndreFCruz / PLOG_MT1_2016-2017.pl
Last active November 21, 2017 19:50
Soluções para o MT1 2016-2017 PLOG
:- use_module(library(lists)).
:- dynamic film/4.
% Factos
film('A', [action, adventure, fantasy], 115, 7.6).
film('B', [biography, drama, romance], 131, 8.7).
film('C', [action, adventure, crime], 121, 6.4).
film('D', [drama, mystery, scifi], 116, 8.5).
film('E', [action, crime, drama], 127, 7.6).
film('F', [drama, mystery, thriller], 112, 6.7).
@AndreFCruz
AndreFCruz / teste_modelo.pl
Last active November 20, 2017 22:16
Soluções para o teste modelo de PLOG, disponível no Moodle. 2017/2018
:- use_module(library(lists)).
%% Teste Modelo 17/18
%participant(Id,Age,Performance)
participant(1234, 17, 'Pé coxinho').
participant(3423, 21, 'Programar com os pés').
participant(3788, 20, 'Sing a Bit').
participant(4865, 22, 'Pontes de esparguete').
participant(8937, 19, 'Pontes de pen-drives').
@AndreFCruz
AndreFCruz / PLOG_Recurso1617.pl
Last active November 20, 2017 09:42
Soluções para o Recurso do MT1 de PLOG - 2016-2017.
:- use_module(library(lists)).
:- use_module(library(sets)).
:- dynamic film/4.
:- dynamic user/3.
:- dynamic vote/2.
%film/Title,Categories,Duration,AvgClassification).
film('Doctor Strange',[action,adventure,fantasy],115,7.6).
@AndreFCruz
AndreFCruz / PLOG_Exame_1314.pl
Created November 20, 2017 16:04
Resolução PLOG Exame Normal 2013/2014 - Primeira Parte
% PLOG Exame Normal 2013/2014
:- use_module(library(lists)).
:- use_module(library(sets)).
% EXERCICIO 2
stat(ana, evelyn, 150, 200).
stat(ana, thresh, 200, 200).
@AndreFCruz
AndreFCruz / teste_modelo_2.pl
Created January 6, 2018 18:44
Resolução do Teste Modelo 2, PLOG, 17-18
%% Mini-Teste 2 2017 (16-17)
:- use_module(library(lists)).
:- use_module(library(clpfd)).
%% P3
p2(L1,L2) :-
length(L1,N),
length(L2,N),
%