nix-build pcc.nix
nix-env -f pcc.nix -i pcc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:- use_module(library(dcgs)). | |
:- use_module(library(clpz)). | |
hex_number(N) --> | |
hex(A), | |
hex(B), | |
{ | |
N #= B + A*16 | |
}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:- use_module(library(clpz)). | |
match(L, V, P) :- | |
L #> V, | |
P #= 3. | |
match(L, V, P) :- | |
L #= V, | |
P #= 1. | |
match(L, V, P) :- | |
L #< V, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "gglog" | |
version = "0.1.0" | |
authors = ["Adrián Arroyo Calle"] | |
edition = "2018" | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[lib] | |
crate-type = ["cdylib"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
Written in February 2021 by Adrián Arroyo (adrian.arroyocalle@gmail.com) | |
This library provides reasoning about UUID (only version 4 right now). | |
There are two predicates: | |
* uuid/2, to generate a new UUID (only version 4 supported) | |
* uuid_string/2, to converte between UUID list of bytes and UUID hex representation | |
Also you have uuid/1, which generates a UUIDv4 as a list of bytes and uuid_string/1 | |
which generates a random UUIDv4 as hex representation | |
I place this code in the public domain. Use it in any way you want. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:- use_module(library(pure_input)). | |
:- use_module(library(dcg/basics)). | |
input([X|Data]) --> | |
integer(X), | |
"\n", | |
input(Data). | |
input([]) --> eos. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn interpreter(&mut self,bytecode: &'static str) -> (){ | |
for execbyte in bytecode.chars() { | |
self.execute(execbyte as u8); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/spark-3.0xxxx/bin/spark-submit sparky.py | |
from pyspark.sql import SparkSession | |
spark = SparkSession.builder.appName("test").getOrCreate() | |
sc = spark.sparkContext | |
# Word Count | |
inputfile = sc.textFile("input.txt") | |
counts = inputfile.flatMap(lambda x: x.split(" ")).map(lambda x: (x, 1)).reduceByKey(lambda x,y: x+y) | |
counts.saveAsTextFile("output") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
wget https://github.com/aarroyoc/pcc/archive/master.zip -O pcc.zip | |
unzip pcc.zip | |
mkdir -p pcc-master/debian | |
cp {compat,install,control,changelog,rules} pcc-master/debian/ | |
cd pcc-master | |
dpkg-buildpackage -us -uc |