Skip to content

Instantly share code, notes, and snippets.

View aarroyoc's full-sized avatar

Adrián Arroyo Calle aarroyoc

View GitHub Profile
@aarroyoc
aarroyoc / aarroyoc.keymap
Created August 28, 2024 10:22
aarroyoc.keymap
/*
* Copyright (c) 2020 The ZMK Contributors
* Copyright (c) 2023 Innaworks Development Limited, trading as MoErgo
*
* SPDX-License-Identifier: MIT
*/
/* THIS FILE WAS GENERATED BY GLOVE80 LAYOUT EDITOR
as main.s -o main.o
ld main.o -o main
./main
@aarroyoc
aarroyoc / main.pl
Created December 1, 2023 14:38
Advent of Code 2023 - Day 1
:- use_module(library(pio)).
:- use_module(library(dcgs)).
:- use_module(library(charsio)).
:- use_module(library(reif)).
:- use_module(library(dif)).
:- use_module(library(lists)).
lines([]) --> [].
lines([X|Xs]) -->
line(X),
@aarroyoc
aarroyoc / wc.pl
Created November 18, 2022 22:16
Word Counter Scryer Prolog
:- use_module(library(format)).
:- use_module(library(lists)).
:- use_module(library(pio)).
:- initialization(run).
run :-
phrase_from_file(state(was_space, 1, 0, 0, Lines, Words, Chars), "quijote.txt"),
format("~d ~d ~d~n", [Lines, Words, Chars]),
halt.
:- use_module(library(clpz)).
:- use_module(library(lists)).
:- use_module(library(format)).
cols(6).
rows(6).
board([
c,c,2,c,3,c,
2,c,c,c,c,c,
c,c,2,4,c,3,
@aarroyoc
aarroyoc / Makefile
Created August 21, 2022 20:32
Fibonacci numbers in RISC-V 64
default:
gcc -o fib fib.s -static
clean:
rm -rf fib
@aarroyoc
aarroyoc / fib-arm64.s
Created August 2, 2022 19:53
Fibonacci Numbers ARM64 Linux
.data
fibs: .quad 0,0,0,0,0,0,0,0,0,0,0,0
size: .quad 12
printf_str: .asciz "%d\n"
head: .ascii "The Fibonacci numbers are:\n"
head_len = . - head
.text
.global main
main:
:- use_module(library(lists)).
:- use_module(library(random)).
:- use_module(library(tabling)).
:- table move/2.
run(N) :-
generate_random(N, State),
solve(State, History),
maplist(display_state, History).
@aarroyoc
aarroyoc / snake.py
Created April 5, 2022 22:23
Snake wxPython
import wx
from enum import Enum
import random
from collections import deque
import xml.etree.ElementTree as ET
GRID_SIZE = 20
WIDTH = 650
HEIGHT = 690
TABLE_SIZE = 30
% Runs on Scryer Prolog
%
% scryer-prolog morse.pl
%
% ?- solve("TEXT or MORSE", Output).
%
:- use_module(library(dcgs)).
:- use_module(library(lists)).
:- use_module(library(reif)).