You are not logged in.

#1 2019-11-13 09:38:09

limpr
Member
Registered: 2015-10-08
Posts: 10

Translation help: "code" or "output"

I'm currently translating a semi-fictional novel about Bitcoin (on a Bunsenlabs machine, of course). In one scene a hacker is looking at "code" that's flowing up the screen. Now, from my very little scripting experience, the flowing lines ought to be output, not code. Am I right? Or is there any situation where looking at a stream of code would be helpful.

I'd hate to embarrass myself in front of more competent readers, so any clarification is appreciated.

Offline

#2 2019-11-13 12:59:15

clusterF
Member
Registered: 2019-05-07
Posts: 297

Re: Translation help: "code" or "output"

Code is inside the program neo.

Try this in a terminal.

COL=$(( $(tput cols) / 2 )); clear; tput setaf 2; while :; do tput cup $((RANDOM%COL)) $((RANDOM%COL)); printf "%$((RANDOM%COL))s" $((RANDOM%2)); done

"Common sense is like deodorant, those who need it the most never use it."

git: clusterF

Offline

#3 2019-11-13 13:24:03

limpr
Member
Registered: 2015-10-08
Posts: 10

Re: Translation help: "code" or "output"

clusterF wrote:

Try this in a terminal.

Haha, I'll leave it running to freak out my coworkers.

Offline

#4 2019-11-13 20:14:47

eight.bit.al
Member
From: The top of the World
Registered: 2015-10-01
Posts: 372

Re: Translation help: "code" or "output"

$ sudo apt install cmatrix

8bit


A mind is a terrible thing not to change.
The problem lies not with new ideas, but in escaping the old ones.

Offline

#5 2019-11-13 20:35:21

damo
....moderator....
Registered: 2015-08-20
Posts: 5,251

Re: Translation help: "code" or "output"

(@OP sorry about the thread drift)

And there is this python script for a matrix-like effect...

#!/usr/bin/env python
#Create "The Matrix" of binary numbers scrolling vertically in your terminal.

#original code adapted from juancarlospaco:
  #- http://ubuntuforums.org/showpost.php?p=10306676

#Inspired by the movie: The Matrix
  #- Corey Goldberg (2013)
  
import fcntl
import time
import random
import struct
import sys
import termios

class message(str):
    def __new__(cls, text, speed):
        self = super(message, cls).__new__(cls, text)
        self.speed = speed
        self.y = -1 * len(text)
        self.x = random.randint(0, display().width)
        self.skip = 0
        return self

    def move(self):
        if self.speed > self.skip:
            self.skip += 1
        else:
            self.skip = 0
            self.y += 1


class display(list):

    def __init__(self):
        self.height, self.width = struct.unpack('hh', fcntl.ioctl(1, termios.TIOCGWINSZ, '1234'))
        self[:] = [' ' for y in range(self.height) for x in range(self.width)]

    def set_vertical(self, x, y, string):
        string = string[::-1]
        if x < 0:
            x = 80 + x
        if x >= self.width:
            x = self.width - 1
        if y < 0:
            string = string[abs(y):]
            y = 0
        if y + len(string) > self.height:
            string = string[0:self.height - y]
        if y >= self.height:
            return
        start = y * self.width + x
        length = self.width * (y + len(string))
        step = self.width
        self[start:length:step] = string

    def __str__(self):
        return ''.join(self)


def matrix(iterations, sleep_time=.08):
    messages = []
    d = display()
    for _ in range(iterations):
        messages.append(message('10' * 16, random.randint(1, 5)))
        for text in messages:
            d.set_vertical(text.x, text.y, text)
            text.move()
        sys.stdout.write('\033[1m\033[32m%s\033[0m\r' % d)
#        sys.stdout.write('xyz')
        sys.stdout.flush()
        time.sleep(sleep_time)


if __name__ == '__main__':
    while True:
        try:
            matrix(150)
        except KeyboardInterrupt:
            sys.stdout.write('\n\033[1m\033[32m=== Matrix Stopped ====\033[0m\n')
            sys.exit()

Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#6 2019-11-13 20:47:50

damo
....moderator....
Registered: 2015-08-20
Posts: 5,251

Re: Translation help: "code" or "output"

There is also hollywood in the repos, for a "Hollywood" output in the terminal!


Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#7 2019-11-15 07:48:09

ohnonot
...again
Registered: 2015-09-29
Posts: 4,159
Website

Re: Translation help: "code" or "output"

limpr wrote:

from my very little scripting experience, the flowing lines ought to be output, not code. Am I right? Or is there any situation where looking at a stream of code would be helpful.

I have wondered that myself, posting to forums etc.
IMO code is something that needs to be executable one way or another (even HTML is code), and output is something that is produced by software.
But in my experience even IT specialists & native English speakers tend to call output code - but not the other way round.

Offline

#8 2019-11-15 07:57:23

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 6,061
Website

Re: Translation help: "code" or "output"

Some output is code, no?

Are config files code? Maybe anything that's written to be read by a computer is code?


John
--------------------
( a boring Japan blog, idle Twitterings and GitStuff )
In case you forget, the rules.

Offline

#9 2019-11-15 08:27:18

ohnonot
...again
Registered: 2015-09-29
Posts: 4,159
Website

Re: Translation help: "code" or "output"

johnraff wrote:

Are config files code?

Yes, I did not consider config files. I'd say they count as code.

Maybe anything that's written to be read by a computer is code?

Exactly.
Terminal output is not primarily written to be read by a computer!

Offline

#10 2019-11-15 15:01:33

clusterF
Member
Registered: 2019-05-07
Posts: 297

Re: Translation help: "code" or "output"

Having recently looked into the spectrwm window manager i believe they really struck a good balance in regards to the config file to run the code, that being the window manager written in C and shell scripts. This probably delves into programming language as not all programs need a config file to execute.


"Common sense is like deodorant, those who need it the most never use it."

git: clusterF

Offline

#11 2019-11-17 17:48:05

ohnonot
...again
Registered: 2015-09-29
Posts: 4,159
Website

Re: Translation help: "code" or "output"

^ I guess you talk about human readable code there.
Yeah, it's important.
Just compare fluxbox' config file syntax to openbox'!

Offline

Board footer

Powered by FluxBB