Skip to content

Instantly share code, notes, and snippets.

View yackx's full-sized avatar

Youri Ackx yackx

View GitHub Profile
@yackx
yackx / detective.pl
Created August 13, 2024 13:26
Detective solving a murder case in Prolog
% You are a detective trying to solve a murder case.
% There are three suspects - Art, Burt, and Carl.
% They are also the only three witnesses.
%
% Here are their statements:
%
% Art:
% Burt was the victim's friend, but the victim and carl were deadly
% enemies.
%
@yackx
yackx / fizz-buzz.dasm
Created December 4, 2021 17:10
FizzBuzz programming interview - 8 bits assembler MOS6502 for C64 💾👴
; The infamous FizzBuzz programming interview
;
; Youri Ackx
; assmbler=dasm
;
include "upstart.dasm"
processor 6502
PRINT_PTR equ $10 ; Print string at address
COUNT_TO equ 100 ; How much of FizzBuzz
#!/bin/bash
for lib in lib{gmp,mpfr,mpc}.la; do
echo $lib: $(if find /usr/lib* -name $lib|
grep -q $lib;then :;else echo not;fi) found
done
unset lib
@yackx
yackx / boot1.asm
Created December 21, 2016 13:21
Bootload FAT12
;*********************************************
; Boot1.asm
; - A Simple Bootloader
;
; Operating Systems Development Tutorial
;*********************************************
bits 16 ; we are in 16 bit real mode
@yackx
yackx / intersect-bug.groovy
Created August 26, 2016 19:15
Check for Collection.intersect() bug that affects some Groovy versions
// Check Groovy intersect bug
def checkIntersectBug() {
def foo = [[1], [2], [3]]
def bar = [[2], [3], [4]]
if (foo.intersect(bar).size() != 2) {
println '''Warning!
The version of Groovy that you are running contains a bug on Collection.intersect().
Upgrade to 2.4.7 or later.
See http://stackoverflow.com/questions/35493088/groovy-strange-collectionintersect-behaviour
@yackx
yackx / 2016.groovy
Created January 2, 2016 13:46
Mind-blowing 2016 facts
assert (1..63).sum() == 2016
assert 666 + 666 + 666 + 6 + 6 + 6 == 2016
@yackx
yackx / hello-boot.asm
Created December 10, 2014 10:56
Hello World bootloader in assembly language
;----------------------------------------------;
;
; A minimal bootloader that prints a hello world
; then halts.
;
; nasm -f bin hello-boot.asm -o hello-boot.bin
;
; @YouriAckx
;
;----------------------------------------------;
@yackx
yackx / gist:a9bf4e4e639e68907c14
Created May 7, 2014 14:06
Remove trailing spaces inserted by Hippo CMS at the end of some .xml files
#!/usr/bin/env groovy
/*
* Remove nasty trailing spaces inserted by the naughty Hippo
* at the end of some .xml files.
*/
@Grab('org.apache.commons:commons-lang3:3.3.1')
import org.apache.commons.lang3.StringUtils
@yackx
yackx / peano.go
Created February 5, 2014 07:58
Peano integers in Go
// Peano integers are represented by a linked
// list whose nodes contain no data
// (the nodes are the data).
// http://en.wikipedia.org/wiki/Peano_axioms
package main
import "fmt"
// Number is a pointer to a Number
@yackx
yackx / philosophers.groovy
Created February 3, 2014 12:52
Dining Philosophers
#!/usr/bin/env groovy
import static groovyx.gpars.GParsPool.withPool
import groovy.transform.*
import java.util.concurrent.*
@TypeChecked
class Philosopher {