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
# Helper for computing the date of Easter Sunday. | |
require 'date' | |
class Date | |
def self.easter_sunday(year) | |
a = year % 19 | |
b, c = year.divmod 100 | |
d, e = b.divmod 4 | |
g = (8 * b + 13) / 25 |
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
; Kempston mouse driver with master/slave support. | |
; Written by Patrik Rak in 2013, and revised in 2016. | |
; Based on a driver originally written for testing ZXDS, see the original WoS post | |
; in the thread at http://www.worldofspectrum.org/forums/discussion/43026/mouse-systems-for-zx-spectrum | |
updatemouse | |
ld hl,ports | |
ld de,mouseinput | |
ld c,0xDF | |
.loop ld b,(hl) |
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
# Compact Sudoku solver and generator | |
# | |
# Written by Patrik Rak in 2009 to test the power of Ruby | |
class Sudoku | |
# Dimensions. | |
B = 3 | |
N = B * B | |
SIZE = N * N |
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
// Z80 disassembler. | |
// | |
// Written by Patrik Rak for ZXDS in 2010, released under MIT license in 2011. | |
// | |
// There are two main entry points, one for doing the full blown disassembly, | |
// the other one for just measuring how many bytes given opcode sequence takes. | |
// | |
// The full details are below: | |
// | |
// const char * |
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
# Simple Money helper. | |
# | |
# Written by Patrik Rak in 2014. | |
# Money class for convenient working with amounts internally stored in cents. | |
class Money | |
# Helper class for handling left hand side arguments of binary operators. | |
class Scalar | |
include Comparable |
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
; 8-bit Complementary-Multiply-With-Carry (CMWC) random number generator. | |
; Created by Patrik Rak in 2012, and revised in 2014/2015, | |
; with optimization contribution from Einar Saukas and Alan Albrecht. | |
; See http://www.worldofspectrum.org/forums/showthread.php?t=39632 | |
org 40000 | |
call rnd ; BASIC driver | |
ld c,a | |
ld b,0 |
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
; 8-bit Xor-Shift random number generator. | |
; Created by Patrik Rak in 2008 and revised in 2011/2012. | |
; See http://www.worldofspectrum.org/forums/showthread.php?t=23070 | |
org 40000 | |
call rnd ; BASIC driver | |
ld c,a | |
ld b,0 | |
ret |
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
# Decoder for passwords created by multiuser.library of Amiga MultiUser muFS filesystem (ACrypt() encoded, AKA AS225r2 format). | |
# Copyright (C) 2015 Patrik Rak ([email protected]) | |
# This source code is released under the MIT license. | |
def decode( password, user, base = 'A' ) | |
r = 53 | |
s = password.bytes.map{ |x| x - 'A'.ord } + [ 0 ] * 12 |