Maja changed the topic of ##bash-crimes to: we bash back | club of folks preoccupied in whether they could, not whether they should | logs https://libera.irclog.whitequark.org/~h~bash-crimes
janvhs has quit [Remote host closed the connection]
janvhs has joined ##bash-crimes
dakkar has joined ##bash-crimes
<sdomi> Maja: re: arr; perhaps more surprising is that you can use expansions of the same array you're defining: arr=(foo bar [0]+=baz [0]=${arr[0]:1}); declare -p arr
<sdomi> this fucks and I need to abuse it
<dakkar> that `${arr[0]}` is accessing the value of `arr` from before the assignment, right?
<sdomi> with replacement expansions (i.e. `a=${b:-something}`) one could even treat this as a chain of really crude logic
<dakkar> `unset arr;arr=(foo bar [0]+=baz [0]=${arr[0]:1}); declare -p arr` → `declare -a arr=([0]="" [1]="bar")`
<sdomi> dakkar: awh indeed
<sdomi> once again my bad
<dakkar> it's "just" because using a name as an array *makes it* refer to an array
<dakkar> it's not as magical/evil as we could have liked 😁
<sdomi> from less insane things: this mixed syntax can be used for some cool things, like sparse arrays
<sdomi> $ unset arr; arr=([0x7fff]='' a b c); declare -p arr
<sdomi> declare -a arr=([32767]="" [32768]="a" [32769]="b" [32770]="c"
<sdomi> ~~i'm using this in my NES emulator to read out the ROM into the proper address space~~
tastytea has left ##bash-crimes [##bash-crimes]
whitequark[cis] has joined ##bash-crimes
<whitequark[cis]> you have a NES emulator in bash?
<isabella> probably not
<isabella> CPU
<isabella> Ricoh 2A03 @ 1.79 MHz
<isabella> Ricoh 2A07 @ 1.66 MHz[c]
<isabella> $ time for i in {1..1660000}; do :; done
<isabella> real 1.187 user 1.139 sys 0.048
<whitequark[cis]> doesn't seem too bad
<whitequark[cis]> you'll just have to play at 1 fps :3
<whitequark[cis]> well or you could write a JIT in bash
<isabella> yeah you can do it as long as you offload the bulk of the runtime to anything other than bash code
<jn_> dd of=/proc/self/mem is just there ;p
<misentropy> lol
<isabella> that opens dd's memory >.>
<jn_> oh wait, right
<jn_> needs some tweaking
<jn_> simplest solution is probably dd ... > /proc/self/mem because in that case the self symlink should be resolved in bash because bash opens the file
<jn_> (i've done something similar before, but i forgot the exact incantation that works)
<dakkar> `/proc/$$/mem` ?
<jn_> dakkar: thanks, i forgot the name of that variable
jn_ is now known as jn
<zip> btw jn are you jneen or a different jn
<jn> someone else, pretty sure (i've never seen that name)
<zip> ah, fair enough. she's absolutely the type to perpetrate programming language crimes...
<sdomi> concept: what if we made a spiritual successor to wiki.bash-hackers.org
<sdomi> would anyone be up for helping with that
<sdomi> whitequark[cis]: isabella: yes, actually! a really slow one
<sdomi> i have most of the cpu emulation done and some PPU for graphics
<sdomi> it renders sprites from some test roms
<whitequark[cis]> cursed
<sdomi> thank you, that's what i strive for :3
<sdomi> coming back to the wiki concecpt - i'd backport what was on bash-hackers, then we could add some cool curated hacks
<sdomi> need to check what license the old wiki is at..
dakkar has quit [Ping timeout: 245 seconds]
<isabella> ok but like
<isabella> it's a game console
<isabella> if it runs 10000x too slow it's too slow
<isabella> there are things like chip8 which may be suitable for bash
<sdomi> isabella: it's not meant to be practical, i don't aim for 100% speed because that's somewhat unrealistic
<sdomi> still, running test carts I got them to output some graphics within a few seconds
<isabella> okies
<sdomi> sorry if this doesn't match your definition
<sdomi> it's not finished either so i didn't want to brag about it, it just was somewhat relevant to the discussion...
<isabella> it's not my definition sdomi
<isabella> it's on wikipedia
<isabella> i didn't write that
<isabella> you picked a very specific piece of hardware with a very specific purpose
<sdomi> ,_,
<sdomi> please no bully
<isabella> i'm not bullying you
<isabella> i think emulating a 6502 is cool
<isabella> i just don't think you're going to emulate an nes
<sdomi> alright then, i have an emulator for a subset of 2a03 + 2c02
<isabella> okies
* sdomi sighs
<isabella> i didn't mean to gatekeep or whatever
<isabella> i just don't think it's doable
<isabella> it will be several orders of magnitude too slow to play games on