Hacker News new | past | comments | ask | show | jobs | submit | jolmg's comments login

> One of the things that this person does is simply echo to /dev/lp0.

> So, if I plug a USB printer into a computer, and ls > /dev/usbXXX, will it print today? Does that still "just work"?

Both of the following worked for me:

  printf 'hello\f' > /dev/usb/lp0
  printf 'hello\f' | nc -N $printer_ip 9100
This is on a Brother laser printer. Its programming guide is linked next to its manual online. The language is PCL, but you don't really need to know much about it to get simple stuff printed.

Neither of the above involve CUPS. Using the `lp`/`lpr` executable like in other comments requires the printer to be registered with CUPS first.

For `ls >`, the printer expects DOS line endings. `\n` just moves to a new line without "returning the carriage", so you need to pipe through `sed 's/$/\r/'` or use `nc -C`.

With the USB connection, you can print multiple times to build a single page and it won't come out until you provide the form feed. With the TCP connection, the page will be printed when the connection is closed.


> Using the `lp`/`lpr` executable like in other comments requires the printer to be registered with CUPS first.

In modern Linux distros, lp/lpd are usually shims provided for backward compatibility, but it doesn't have to be that way. For example FreeBSD seems to provide support for lpd without for cups [1], although I don't see any real advantage in doing that.

[1] https://docs.freebsd.org/en/books/handbook/printing/


OpenBSD does as well. The advantage is you don’t need CUPS.

But you do still need to register the printer prior to using, or at least have a basic registration set up that works with it.

The relevant parts from the bash manpage:

> arg1 OP arg2

> OP is one of -eq, -ne, -lt, -le, -gt, or -ge. [...] When used with the [[ command, Arg1 and Arg2 are evaluated as arithmetic expressions (see ARITHMETIC EVALUATION above).

> ARITHMETIC EVALUATION

> Within an expression, shell variables may also be referenced by name without using the parameter expansion syntax.

> The value of a variable is evaluated as an arithmetic expression when it is referenced

> Arrays

> The subscript is treated as an arithmetic expression that must evaluate to a number.

> [[ expression ]]

> The shell performs [...] arithmetic expansion, command substitution [...] on those words.

Given that reading, that both subscripts and values of variables in arithmetic expression are treated as arithmetic expressions, and that command substitution is peformed after arithmetic expansion in `[[`, I kinda expected the following to work:

  $ x='$(echo >&2 what; echo 0)'; [[ 0 -eq x ]]
  bash: [[: $(echo >&2 what; echo 0): syntax error: operand expected (error token is "$(echo >&2 what; echo 0)")
I don't see in the docs what it is about array subscripts that makes them special with regards to command substitutions in arithmetic expressions.

I don't fully understand what's going on here, but note that arithmetic expansion is for stuff like $((6 * 7)). There's no arithmetic expansion involved in your or Calzifer's examples.

You mean this part of my comment:

>> The shell performs [...] arithmetic expansion, command substitution [...] on those words.

> [...] and that command substitution is peformed after arithmetic expansion in `[[` [...]

You're right. That doesn't apply. I was equating "arithmetic expansion" with "evaluation of arithmetic expressions", but I see now the former is specifically about `$(())`.


Is that also the case with physical games for consoles? You can't take your disc and play at your friend's house anymore without reactivating and linking your account on their console?

Generally, you can just give the disk to someone else. The physical disk contains the license key for the game.

The issue is that all modern games need to be installed on the internal SSD. So you're not playing of the disk, you're just copying the files from it. And many games require a day-1 patch to work properly. Some even require a constant online connection.

doesitplay.org is a useful database for that information.


I see "Buy now" on Amazon kindle book product pages.

Your point is true, though. It's not all that common to use those words. I thought at least the checkout page would, but I'm seeing "Place your order", which is pretty apt for both purchasing and licensing.


> (4) This section does not apply to any of the following:

> (C) Any digital good that is advertised or offered to a person that the seller cannot revoke access to after the transaction, which includes making the digital good available at the time of purchase for permanent offline download to an external storage source to be used without a connection to the internet.

I can imagine e.g. Amazon arguing that kindle books can be downloaded to kindle devices and phones, and so they apply to this exemption. However, the downloads are only usable through their software, so they technically maintain their ability to revoke access because of that.

Wonder if they'll keep their "Buy now" button on kindle books product pages.


> you're getting a product for either a fixed period [...] neither of which applies here.

Typically, as a practical matter, the license ends with your death. You can't pass your kindle ebooks and steam games as inheritance like you can with physical books and game discs.


It will be interesting to see this challenged in court, because it's a clear violation of the first sale doctrine.

In any event you are within both your moral and legal rights, in the USA at least, to backup any software you have purchased and you should do so if you care about it.

And nobody is going to be able to stop you from leaving those backups to your kids.

It is interesting though how the software business has managed to, via the courts, meme software licenses into existence. The simple fact is that under written US law no license is required to run software you have acquired a lawful copy of. The law explicitly gives you the right to make additional copies as necessary to execute the program. Case law of course is another matter. And lawfare is another matter on top of that. Who wants to spend the rest of their life being sued by Adobe because they want to sell a copy of photoshop they no longer use?


Ah, true!

> I get the feeling it's going to break all shar archives with binary files

shar encodes binary files. Here's what it does with a file that has contents: "foo\0bar\n":

    sed 's/^X//' << 'SHAR_EOF' | uudecode &&
  begin 600 foo.txt
  (9F]O`&)A<@K.
  `
  end
  SHAR_EOF

Interestingly, passing that heredoc to uudecode in the shell, it produces no output. However, if I pass the whole shar output to unshar, it does produce the file with the correct content.

Probably because they're not characters. They're just bytes undefined by ASCII.


> You have, in some countries, the legal right "to request" work from home under laws typically aimed at flexible working. But that's it.

I would think, generally speaking, you have the right to request anything of anyone anywhere. Do those laws do anything?


I believe some of these flexible working request laws mean that companies must consider whether it's reasonable (for the business) and allow it if it's reasonable.

It's fairly toothless in most jurisdictions since businesses can just say it's unreasonable and not elaborate.


They force the employer to give a reason, and that reason has to be "reasonable", i.e. can be fought in courts if it's "that's just how we do it here".


The idea behind those laws is you cannot be fired for asking this.


Probably forcing the creation of a paper trail for possible future litigation


Most cases do have some notable restrictions on that.

For instance, requesting sex in exchange for money is illegal in most places.

Requesting someone commit a crime on your behalf in exchange for money or other compensation as well (conspiracy, usually).

Several other examples too - requesting someone fix their prices, agree to not compete with you in exchange for the same, etc.


> Having `exit` or `quit` without the parens work might accommodate some people whose first choice isn't to call a function (I guess because they're thinking of the REPL as a shell?),

In ruby, parentheses are optional for function calls. `exit` is a regular call, not some REPL peculiarity.

EDIT: Nevermind. Just found that despite the `exit` method being already defined, both irb and pry overshadow that with a repl command that does the same thing. Maybe it's so that it can't be redefined.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: