Readit News logoReadit News
aexaey commented on Bash 5.0 released   lists.gnu.org/archive/htm... · Posted by u/siteshwar
_kst_ · 7 years ago
With this release, bash now has three built-in variables (um, I mean "parameters") whose values are updated every time they're read:

$RANDOM yields a random integer in the range 0..32767. (This feature was already there.)

$EPOCHSECONDS yields the whole number of seconds since the epoch.

$EPOCHREALTIME yields the number of seconds since the epoch with microsecond precision.

I'm thinking of a new shell feature that would allow the user to define similar variables. For example, I have $today set to the current date in YYYY-MM-DD format, and I have to jump through some minor hoops to keep it up to date.

Does anyone else think this would be useful enough to propose as a new bash feature? Would it create any potential security holes? Should variables like $PATH be exempted?

(Of course this doesn't add any new functionality, since I could use "$(date +%F)" in place of "$today". It's just a bit of syntactic sugar.)

aexaey · 7 years ago
How does function sound for a syntactic sugar?

  $ today() { date +%F; }
  $ echo Today, $(today) is a great day!
  Today, 2019-01-08 is a great day!

Deleted Comment

aexaey commented on Zulip – Open-source, threading-based Slack alternative   zulipchat.com/... · Posted by u/tonteldoos
aexaey · 8 years ago
Since nobody mentioned Zulip's REST API yet, I'll do. There is one, and and it is really good.

There are also native language-specific wrappers for that API, for example in python[1], which lets you write a bot in 5 lines:

  import zulip
  client = zulip.Client()
  def onmsg(m):
     print ("at %d, %s said: %s" %
          (m['timestamp'],
           m['sender_email'],
           m['content']))
  client.call_on_each_message(callback=onmsg)
[1] https://pypi.org/project/zulip/

Deleted Comment

Deleted Comment

aexaey commented on Scaleway – NVMe SSD Servers and Hot Snapshot   blog.online.net/2018/05/0... · Posted by u/olragon
reacweb · 8 years ago
hello, my personal website is running on a scaleway C1 (dirt cheap baremetal arm) since 3 oct 2015. There were some network issues the first months. No problem since. My main administrative task is: apt-get update/upgrade every week and backup of my site every couple of month.
aexaey · 8 years ago

  > apt-get update/upgrade every week
Have a look at: https://wiki.debian.org/UnattendedUpgrades

aexaey commented on 1.1.1.1: Fast, privacy-first consumer DNS service   blog.cloudflare.com/annou... · Posted by u/_l4jh
pishpash · 8 years ago
0.0.0.0 is not localhost. It's "any address".
aexaey · 8 years ago
Yes, you're right.

What I was trying to say is - On Linux, INADDR_ANY (0.0.0.0) supplied to connect() or sendto() calls is treated as a synonym for INADDR_LOOPBACK (127.0.0.1) address.

Not so for bind() or course.

aexaey commented on 1.1.1.1: Fast, privacy-first consumer DNS service   blog.cloudflare.com/annou... · Posted by u/_l4jh
dieulot · 8 years ago
The most useful case for this shortcut is 127.1 -> 127.0.0.1
aexaey · 8 years ago
0, which is a shorthand for 0.0.0.0 is likely the most code-golf-y way to write localhost, as many [EDIT: Linux] systems alias 0.0.0.0 to 127.0.0.1:

  $ ping 0
  PING 0 (127.0.0.1) 56(84) bytes of data.
  64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.032 ms
Of course, don't expect this to work universally. A lot of software will try to be clever with input validation, and fail.

Tangentially related: https://fosdem.org/2018/schedule/event/email_address_quiz/

aexaey commented on 1.1.1.1: Fast, privacy-first consumer DNS service   blog.cloudflare.com/annou... · Posted by u/_l4jh
DyslexicAtheist · 8 years ago
TIL you can also use 1.1 and it will expand to 1.0.0.1

  $> ping 1.1

  PING 1.1 (1.0.0.1) 56(84) bytes of data.
  64 bytes from 1.0.0.1: icmp_seq=1 ttl=55 time=28.3 ms
  64 bytes from 1.0.0.1: icmp_seq=2 ttl=55 time=33.0 ms
  64 bytes from 1.0.0.1: icmp_seq=3 ttl=55 time=43.6 ms
  64 bytes from 1.0.0.1: icmp_seq=4 ttl=55 time=41.7 ms
  64 bytes from 1.0.0.1: icmp_seq=5 ttl=55 time=56.5 ms
  64 bytes from 1.0.0.1: icmp_seq=6 ttl=55 time=38.4 ms
  64 bytes from 1.0.0.1: icmp_seq=7 ttl=55 time=34.8 ms
  64 bytes from 1.0.0.1: icmp_seq=8 ttl=55 time=45.7 ms
  64 bytes from 1.0.0.1: icmp_seq=9 ttl=55 time=45.2 ms
  64 bytes from 1.0.0.1: icmp_seq=10 ttl=55 time=43.1 ms

aexaey · 8 years ago

  1.2 -> 1.0.0.2
  1.2.3 -> 1.2.0.3
But then, much of software would fail here - Firefox/Chrome for example would both threat that as bareword and redirect to search page.

aexaey commented on Building my own 64GB memory card with a $6 eMMC chip (2016)   ripitapart.com/2016/10/28... · Posted by u/nfriedly
AstralStorm · 8 years ago
These chips were low performance and limited number of write cycles. Even with a great controller (which would be expensive) you're looking at slow transfer rates. If it reaches USB 2 capabilities, you're lucky. This guy kinda was.
aexaey · 8 years ago
SD cards and eMMC chips[0] do have controller inside. Usually not a great one (tens to hundred-ish MB/s), but that's good enough - overwhelming majority of smartphones/tablets use eMMC for internal storage.

UFS/eUFS cards keep (sort of) same form-factor [1] but bring significant speed boost. [2]

[0] Technically, it is incorrect to say "eMMC chip", as there are typically two (or more) silicon chips inside the same plastic BGA package. One of them is controller.

[1] https://www.dpreview.com/news/6387181333/samsung-launches-fi...

[2] https://en.wikipedia.org/wiki/Universal_Flash_Storage#Versio...

u/aexaey

KarmaCake day789July 21, 2015View Original