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
defmodule MatMul do | |
use ExUnit.Case | |
def matmul(m1, m2) do | |
{rows1, cols1} = m1.shape | |
{rows2, cols2} = m2.shape | |
assert cols1 == rows2 | |
m2t = Nx.transpose(m2) | |
for row <- 0..rows1-1, col <- 0..cols2-1 | |
do |
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
%%%% Boys in the Hood | |
%%%% https://llaisdy.co.uk/2020/08/26/solving-a-logic-puzzle-with-clingo/ | |
%%%% The world. | |
episode(1..5). | |
victim(friar_tuck; little_john; maid_marian; much; will_scarlet). | |
location(inn; dungeon; lodge; gaol; stocks). | |
disguise(abbot; shepherd; phantom; prince_john; washerwoman). | |
%% For each Episode, there is one (V,L,D) combination, |
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
defmodule Drop do | |
def clown1(x) do | |
5 * x | |
end | |
def clown2a(x) do 5 * x end | |
def clown2b (x) do 5 * x end | |
def clown2c x do 5 * x end | |
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
$ env CC=gcc ./rebar compile | |
==> rdma_dist-master (compile) | |
Compiling c_src/rdma_drv.c | |
In file included from c_src/rdma_drv.c:17:0: | |
/usr/include/arpa/inet.h:27:1: error: unknown type name ‘__socklen_t’ | |
typedef __socklen_t socklen_t; | |
^ | |
/usr/include/arpa/inet.h:35:1: error: unknown type name ‘in_addr_t’ | |
extern in_addr_t inet_addr (__const char *__cp) __THROW; | |
^ |
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
<!DOCTYPE html> | |
<html> | |
<head><meta charset="UTF-8"/></head> | |
<body> | |
<h1>Sortable Demo</h1> | |
<div id="demo"></div> | |
<div id="jsfooter"> | |
<script src="https://fb.me/react-0.13.3.min.js"></script> |
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
% hex tiles puzzle | |
% - https://chris-lamb.co.uk/posts/giants-causeway-puzzle | |
% - https://llaisdy.wordpress.com/2015/01/13/that-giants-causeway-puzzle-in-prolog/ | |
:- use_module(library(clpfd)). %% for all_different/1 | |
%% tile(Name, Colours). | |
% tiles from picture |
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
-module(gist). | |
-export([authenticate/3]). | |
authenticate(UserName, Pass, IPAddress) -> | |
Checks = [fun user_ok/1, | |
fun password_ok/1, | |
fun ipaddr_ok/1 | |
], | |
{Result, _} = lists:foldl( | |
fun(_CheckFun, {{error, Reason}, _}) -> |