Created
January 9, 2023 23:09
-
-
Save MinekPo1/311d1557ee55801622b7d5ea60817bbd to your computer and use it in GitHub Desktop.
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
################# | |
# binaryfuck # | |
# in dc # | |
# because I'm a # | |
# massohist # | |
################# | |
# (c) MinekPo1 aka Lily A.N. | |
# under the FAFOL license | |
# which is attached at the | |
# end of this file | |
# note: code has to be provided as three bit segments split by whitespace | |
# code ends when an empty line is inputed | |
# also , inputs a numeric value because dc cannot convert strings | |
# into their ascii values | |
[q]sq | |
# set binary mode | |
2i | |
# read input | |
0si | |
[ | |
? | |
z 0=q | |
[ | |
z 0=q | |
z R | |
li :C | |
li 1+si | |
ltx | |
]dstx | |
llx | |
]dslx | |
# set back to decimal mode | |
1010i | |
[loaded] n[]pn | |
# debug: display code | |
[ | |
[+] 0:d | |
[-] 1:d | |
[>] 2:d | |
[<] 3:d | |
[.] 4:d | |
[,] 5:d | |
[{] 6:d | |
[}] 7:d | |
0sj | |
[ | |
lj d li=q | |
;C;d n | |
lj 1 + sj | |
ltx | |
]dstx | |
[]pn | |
] | |
x | |
c | |
0sj | |
# Two stacks are used to emulate an | |
# infinte array | |
# L - R | |
# R always holds the current value | |
[lR1+256%sR]s+ | |
# since _1 256% => _1, adding 255 works better | |
# than subtracting one | |
[lR255+256%sR]s- | |
[LLSR]s> | |
[LRSL]s< | |
[lRan]s. | |
# due to limitations with dc, input is numeric | |
[?sR]s, | |
[3Q]s! | |
[ | |
[ | |
lj d li=! | |
d :C 7=! | |
1+ sj | |
l_x | |
]s_ lR 0=_ | |
lj Sf | |
]s{ | |
[ | |
Lf | |
lR 0=q | |
d Sf sj | |
]s} | |
[ | |
lj d li=q | |
;C | |
d0=+ | |
d1=- | |
d2=> | |
d3=< | |
d4=. | |
d5=, | |
d6={ | |
d7=} | |
lj 1+ sj | |
# fix memory leaks | |
c | |
lmx | |
]dsmx | |
[]p | |
# The Fuck Around and Find Out License, version 0.2 | |
# | |
# Purpose | |
# | |
# This license gives everyone as much permission to work with | |
# this software as possible, while protecting contributors | |
# from liability, and ensuring this software is used | |
# ethically. | |
# | |
# Acceptance | |
# | |
# In order to receive this license, you must agree to its | |
# rules. The rules of this license are both obligations | |
# under that agreement and conditions to your license. | |
# You must not do anything with this software that triggers | |
# a rule that you cannot or will not follow. | |
# | |
# Copyright | |
# | |
# Each contributor licenses you to do everything with this | |
# software that would otherwise infringe that contributor's | |
# copyright in it. | |
# | |
# Ethics | |
# | |
# This software must be used for Good, not Evil, as | |
# determined by the primary contributors to the software. | |
# | |
# Excuse | |
# | |
# If anyone notifies you in writing that you have not | |
# complied with Ethics, you can keep your | |
# license by taking all practical steps to comply within 30 | |
# days after the notice. If you do not do so, your license | |
# ends immediately. | |
# | |
# Patent | |
# | |
# Each contributor licenses you to do everything with this | |
# software that would otherwise infringe any patent claims | |
# they can license or become able to license. | |
# | |
# Reliability | |
# | |
# No contributor can revoke this license. | |
# | |
# No Liability | |
# | |
# As far as the law allows, this software comes as is, | |
# without any warranty or condition, and no contributor | |
# will be liable to anyone for any damages related to this | |
# software or this license, under any kind of legal claim. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment