Skip to content

Instantly share code, notes, and snippets.

View rosalogia's full-sized avatar

Ambika E rosalogia

View GitHub Profile
@rosalogia
rosalogia / properties.hs
Last active April 23, 2021 17:25
A short Haskell program using QuickCheck to identify whether a defined relation R is an equivalence relation or partial ordering
import Test.QuickCheck
-- unfortunately, function names cannot start with uppercase letters
r :: Positive Integer -> Positive Integer -> Bool
r a b =
let (x, y) = (getPositive a, getPositive b) in
y `mod` (x * x) == 0
implies p q = not p || q
@rosalogia
rosalogia / taglib_demo.ml
Created November 28, 2021 22:19
Simple example of using OCaml taglib bindings to get and set tags on an audio file
(* Make sure you have taglib installed. Find complete
documentation at https://github.com/savonet/ocaml-taglib/blob/master/src/taglib.mli *)
(* We write a small program that either displays or modifies a given
tag for a given audio file.
Usage example:
./main.exe get artist my_song.mp3
or
./main.exe set artist BikaBika my_song.mp3 *)
@rosalogia
rosalogia / tzip12.mligo
Created September 2, 2022 00:52
WIP experimental/educational implementation of TZIP-12 in CameLIGO
type token_id = nat
type amount = nat
type balance_key = {
owner : address;
token_id : token_id
}
type balance_map = (balance_key, amount) map
type storage = balance_map
type parameter =
@rosalogia
rosalogia / echo.c
Last active November 28, 2022 19:44
Simple echo server impl. in C
#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>