« first day (2751 days earlier)      last day (2194 days later) » 

12:11 AM
@EliahKagan I see no reason to think about re-opening that question unless the OP asks. It doesn't appear useful for anyone, and I'd expect some clarification from the OP (e.g., where it came from, hard to say what its useful for otherwise).
I don't think paste a dozen lines of uncommented shell script in the question box with "what does this do"? makes for a very good question :-/
 
Okay, I'll leave it alone.
Yeah, it's not a good question. I was wondering why it was closed as OT instead of unclear. I figured maybe it was clear to some people.
 
@EliahKagan When there are multiple reasons to close it, sometimes things get closed for what you'd consider the #2 reason instead of the #1.
Quite possible the close reason was actually a mix of them, the site picks one to show, even if several close reasons were used.
 
Yeah, I've observed that on Ask Ubuntu as well. :)
 
The only time it really matters is when the close reason getting most votes is to migrate to another site — then a migration happens. Sometimes people (for example) see that a question is about programming, and vote to close as belongs on Stack Overflow despite it being a low-quality question. That shouldn't be done (do not migrate junk).
 
Based on the closure banner, I think four of them were OT, and one of them was something else (presumably unclear, but I don't know). It was closed by five users, only four of whose names are listed under the "posted on multiple sites" sub-reason.
 
12:17 AM
Only thing you can do when you see it happening is to bug a mod.
@EliahKagan Could be, I've never noticed that before!
 
12:36 AM
@derobert "update their malware installers"?
The article you linked to mentions a brute force ssh attack. But I would not have thought that would be successful often, unless you're using really terrible passwords. I can't remember whether the default Debian ssh installation is allowing root login by default or not. I think the maintainer was allowing it, which is probably a bad idea.
I see I have PermitRootLogin without-password
I assume that means via public/private key.
> If this option is set to prohibit-password or without-password, password and keyboard-interactive authentication are disabled for root.
I wonder if that should be "no".
 
@FaheemMitha It doesn't have to be successful that often to infect a lot of computers
but that's what they were doing back then at least, brute forcing ssh accounts.
(quite possibly non-root ones too, there are a lot more local root exploits than remote ones)
 
@derobert If not root, then it has to guess both an account name and a correct password for that account.
 
people try that, as a quick look at any Internet-connected ssh server's logs can attest
 
And presumably there is a limit to how many times it can try to log in before something times out.
@derobert Yes, I used to see that on mine.
 
@FaheemMitha Sure, then connect again and repeat. How many severs with poor passwords have e.g., fail2ban set up?
 
12:43 AM
But not currently, for some reason. I used to have my incoming port to 33, but it seems to be back to 22 now.
 
Or use your existing botnet — then the attempts come from all across the Internet.
 
@derobert There isn't anything outside the server itself which would stop infinite retries?
@derobert Good point.
 
@FaheemMitha Not unless something has been configured. What would?
 
@derobert Shrug. No idea.
 
I'm still getting plenty....
$ grep 'invalid user' /var/log/auth.log | tail
Apr 20 18:47:59 Einstein sshd[20448]: input_userauth_request: invalid user ubuntu [preauth]
Apr 20 19:10:15 Einstein sshd[22069]: input_userauth_request: invalid user butter [preauth]
Apr 20 19:11:55 Einstein sshd[22096]: input_userauth_request: invalid user ftpuser [preauth]
Apr 20 19:29:14 Einstein sshd[22365]: input_userauth_request: invalid user oracle2 [preauth]
Apr 20 19:31:27 Einstein sshd[22417]: input_userauth_request: invalid user ftpuser [preauth]
 
12:45 AM
The ISPs that relay this stuff don't care, I suppose.
 
@FaheemMitha The ISP has no way to know whether its a valid connection or not.
 
@derobert Ugh. This is your home server, or a work server?
 
Home
$ grep 'invalid user' /var/log/auth.log | wc -l
757
 
An easy way to stop it is to use a non-standard port.
 
I'd normally have less, but fail2ban is currently off because I need to do some config changes.
 
12:46 AM
I think I was doing that for awhile. 33, I believe.
The scripts don't seem to check for non-standard ports. I suppose it's not worth their while.
Of course, then you have to remember to use that port yourself.
 
@FaheemMitha Yes, except that can be a PITA depending on what you're intending to connect from. Anyway, it's not really an issue, especially since (except for a few, chosen usernames with 16-character random passwords) its all pubkey only
 
@derobert Do you tend to disable password auth for most things?
 
@FaheemMitha Most Internet-facing things. At least when I can — or lock it down to only accounts I'm sure have strong passwords
 
@derobert Makes sense.
 
 
10 hours later…
10:23 AM
How not to do error messages, this just appeared after an upgrade:
fc-cache -s
Fontconfig error: failed reading config file
Fontconfig error: failed reading config file
Fontconfig error: failed reading config file
Fontconfig error: failed reading config file
Fontconfig error: failed reading config file
Yeah. Umm. Useful.
Clearly all utilities are supposed to be run under strace, so you can get the file name its complaining about.
strace -f -e open,openat -- fc-cache -s |& less
⋮
openat(AT_FDCWD, "/etc/fonts/conf.d/64-wqy-zenhei.conf", O_RDONLY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/etc/fonts/conf.d/65-0-fonts-beng-extra.conf", O_RDONLY|O_CLOEXEC) = 4
Fontconfig error: failed reading config file
openat(AT_FDCWD, "/etc/fonts/conf.d/65-0-fonts-deva-extra.conf", O_RDONLY|O_CLOEXEC) = 4
Fontconfig error: failed reading config file
openat(AT_FDCWD, "/etc/fonts/conf.d/65-0-fonts-gubbi.conf", O_RDONLY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/etc/fonts/conf.d/65-0-fonts-gujr-extra.conf", O_RDONLY|O_CLOEXEC) = 4
 
 
4 hours later…
2:13 PM
Saturday sucks
 
 
1 hour later…
3:29 PM
@Jesse_b Do tell.
 
@FaheemMitha Just boring. I am working and there is usually not much to do on Saturdays
 
3:40 PM
@Jesse_b I thought the US did a 2 day weekend.
@Jesse_b So you can do what you want? Or not?
 
4:13 PM
@FaheemMitha It depends on the company. Traditionally saturday/sunday here is a weekend but I work wednesday through saturday
 
@Jesse_b So 4 days? I think we've talked about that, actually.
The 4 day week, I mean. 10 hour days, presumably.
 
@FaheemMitha correct
It's nice, 3 days off each week allows me to get a lot done as I like to have at least one day where I pretty much just sit around and be lazy the whole day
 
@Jesse_b Sounds good, as long as you can stay focused for 10 hours. Though it doesn't sound like your job is the world's busiest.
 
@FaheemMitha It can get busy but it can also be very slow
 
@Jesse_b I forget what you do.
 
4:22 PM
I work in the NOC for a cloud computing company. Basically just tier1/tier2 server/network support
 
@Jesse_b NOC?
 
network operations center, although we are called the CNOC now for cloud and network operations center
but I think it's stupid so I still just say noc
@FaheemMitha: I saw a clickbait article this morning about terrible airbnb guests and thought of you, what was your worst guest?
 
@Jesse_b A crazy French guy. But he's been the worst guest by some distance. I've been relatively lucky, I suppose.
But I'm also quite picky. And right now my Airbnb listing seems dead, for some reason.
 
what did he do
 
Possibly related to Airbnb putting me way down in the listings.
@Jesse_b Um, a bunch of minor things. But the worst was probably that he wanted to leave his luggage here after checkout and pick it up later.
I said no, because we don't really have a place to keep it. And he hadn't checked with me earlier - he asked the morning of the checkout.
Then he lost it and started yelling. Threatened me with a bad review. Which he indeed wrote - in French.
There was a bunch of stuff before that, he was quite troublesome.
For example, he didn't seem to understand the concept of check-in time.
 
4:36 PM
Customer service sucks
I don't think I could ever do it inside my own home
 
It's definitely possible to get terrible guests. The easiest way to do so it set your prices low and don't bother to check on who you are letting into your home.
@Jesse_b Most of my guests were quite trouble-free. The worst thing they would do it leave the lights on.
Mostly young professionals.
 
my brother used to use airbnb a lot and I imagine he would be a terrible guest
 
@Jesse_b Really? Why?
 
he said a lot of the hosts he encountered are racist though, they would openly ask him if he was white
oh he's just a little asshole (not little though, 6'5 240lbs)
 
@Jesse_b Um - you mean at the time of booking?
I tend to be quite fussy - I cross-examine guests at the time of booking.
Sometimes they don't like it.
 
4:38 PM
@FaheemMitha I guess, I don't know but he has sent me multiple texts of screenshot conversations where people would say like "You are white right?"
 
@Jesse_b Huh. What country?
 
the US
 
Oh. Airbnb explicitly opposes discrimination. Those sorts of messages would probably be grounds for action. Though I'm not sure what.
Did your brother get good reviews?
 
@FaheemMitha I don't know, I didn't even know you could review guests.
Judging by the way he treats the staff at restaurants I would have to imagine no though
 
@Jesse_b On Airbnb you can. Not on all platforms, I think.
@Jesse_b Hmm.
I've had other less than pleasant guests. People from NYC have tended to be sub-par.
 
4:41 PM
@FaheemMitha I agree
 
One guy from NYC left a rather strange and unpleasant review. And he was less than appealing in person too.
Actually there were two single men from NYC, both covered in tattoos, neither of them were very pleasant in a rather similar way. They might have been cousins.
No, not really.
@Jesse_b You agree with what?
 
That people from NYC are sub-par
 
@Jesse_b Oh, really? Is there some kind of concensus, or is that just your opinion?
And they mostly left 4 star reviews, which for Airbnb hosts is bad.
 
I think a lot of people dislike the stereotypical "new yorker" and in my experience that stereotype is one that almost all "new yorkers" have earned
 
But none of those people were really "trouble", like the Crazy Frenchman was.
@Jesse_b Describe the stereotypical "new yorker" to me.
 
4:45 PM
Loud, assertive, fake italian
they all will claim new york is the greatest city in the world but in reality it wouldn't make the top 10 list
 
I actually mildly enjoy meeting people from different cultures and stuff. if they are willing to talk to me, which more often than not, isn't the case.
@Jesse_b Those two men were distinctly unfriendly and a little scary looking (did I mention the tattoos?), and would, like, ask what questions they wanted to ask, and once those questions were answered, they'd simply stop talking.
And one of them actually walked away from me while I was still talking to him. Which I'm happy to say is quite unusual behavior.
 
Sounds pretty new yorky
 
But really, many of the guests weren't really interested in talking. Especially the couples.
Single people were more inclined to talk. Some of them, anyway.
 
although I'm from new jersey and we have a lot of those sorts of behaviors as well.
 
The couples tended to seem quite wrapped up in each other. Some of them. OTOH, some of them were quite friendly.
But overall, really no complaints.
@Jesse_b Hmm. If that sort of thing is common in those areas, I doubt I'd enjoy living there.
I visited NYC for one day, in 2007. It was quite stimulating.
@Jesse_b Have you spent much time in NYC?
 
4:53 PM
@FaheemMitha Not anymore than I needed to. I used to work right across the river and would have to travel into the city from time to time for work
 
@Jesse_b Was it you who recently described NYC as a garbage heap (or something like that)?
@Jesse_b Clearly not a fan. :-)
 
@FaheemMitha It was, the city always smells like urine and they literally just pile trash up in the middle of the streets on garbage day
 
@Jesse_b Oh. Nasty. Didn't see (or smell) any of that while I was there.
> In the first quarter of 2014, the average weekly wage in New York County (Manhattan) was $2,749, representing the highest total among large counties in the United States.
Eek. That's impressively high.
 
makes sense
the average rent there is $3100/month
for a one bedroom
 
@Jesse_b That's a lot of money.
 
5:02 PM
@FaheemMitha It's especially a lot from my perspective because I wouldn't live in NYC if it were free
 
I don't think Airbnb makes a lot of financial sense. I wouldn't recommend it for that reason. I don't think the guests themselves are a big issue.
@Jesse_b Sounds like you really dislike it. You didn't get anything out of the facilities? Opera, art galleries, cinemas, restaurants, theatres, misc. other attractions?
 
Almost all of those things are available basically everywhere (In the US anyway)
 
@Jesse_b Oh, and I forgot places to dance. Everywhere?
 
I don't dance
 
@Jesse_b Well, ok.
It's a fun social thing. I bet NYC has a lot of those. Whether one would enjoy meeting the people, I don't know.
 
5:15 PM
@FaheemMitha I don't enjoy meeting most people though so I'm probably not a fair judge of these things
 
@Jesse_b Dancing can be fun. It's much less stress than standing around, trying to be social, trying to think of what to say. Of course, you have to find a dance style you like.
Like I might have mentioned here before, I really used to enjoy West Coast Swing. Though if you watch the Youtube videos, it doesn't look like much.
And of course, it's good exercise too. And WCS is fairly low-tempo, so it's not hard on the feet, like some dancing is.
About much effort as a really brisk walk.
 
I much prefer to watch people from a distance and unfairly judge them
 
5:33 PM
@Jesse_b For some reason, this conversation made me think of the movie "The Secret of My Success".
Set in New York City, of course.
 
never saw it but I just read the plot and it sounds confusing
 
@Jesse_b Confusing? Not at all. A New York fairytale.
 
I like how the plot has to explain in detail that there is a scene in which the main actress gets naked
 
A distant relative of the much funnier "How to Succeed in Business without Really Trying".
@Jesse_b Are you reading the Wikipedia summary?
 
I did
that scene is mentioned on imdb as well
as if to say "Don't worry, there is sex in the movie"
 
5:49 PM
@Jesse_b There isn't.
 
"She tells him about how her marriage has faltered and that she feels unattractive at her age. Brantley is able to convince her otherwise and the two take a swim where she seduces him. After having sex, she tells him she'll help him advance in the company."
 
"How to Succeed in Business without Really Trying" has some really good scenes. Probably worth watching for that reason alone.
@Jesse_b No sex scenes included.
There is, for example, this really hysterical scene when the main character sings "I Believe In You" to himself in a mirror. Hang on, let me find a Youtube clip.
 
oh no
it's a musical?
 
@Jesse_b Yes, it's a musical.
 
80s movies are overly obnoxious most times. It's much more like a play on screen, the actors are very obviously acting, etc
 
5:55 PM
Though the best part is that song right there.
 
that guy kind of reminds me of jim carrey
the one saying he believes in himself
 
@Jesse_b I agree. You mean Robert Morse? There is a slight resemblance.
 
Mostly the way he is singing there, the faces he is making
 
Yes, it's partly all the facial contortions.
I believe the term is rubber-faced.
 
 
2 hours later…
7:55 PM
am I wrong or is this not what a factorial is?
2
Q: Simple Factorial Challenge

NL628In light of today's date... A factorial of a number n, is the product of all the numbers from 1 to n inclusive. The Challenge Given an integer n where 42 <= n <= 420, find the sum of the digits of n!. It's that simple :P Notes: I feel like this challenge isn't too simple, as some languages ha...

 
That's what a factorial is. This definition (quoting from the post) is both reasonable and common:
> A factorial of a number n, is the product of all the numbers from 1 to n inclusive.
 
Yes the product
but then he asks for the sum
 
(With the clarification that the empty product is 1, so 0! = 1.)
 
this example is given:
Input: 100. Output: 648.
factorial of 100 is: 9.332621544 E+157
 
Oh. Sorry, I thought you were talking about the definition it gave, and I didn't read further in the post!
So... it's asking for the sum of the base-10 digits of the factorial of n, right?
 
7:59 PM
I'm not quite sure, I'm trying to recreate the example results
yea I guess so
 
The answers that have been posted seem to confirm that interpretation.
 
8:16 PM
I can't make bash calculate factorials that high :(
 
Yeah, bash integers are limited in size to the bit width of, I think, long. You can do it with GNU awk, though, if you pass it the -M option.
 
@Jesse_b bc
 
Yeah, bc's a good way. Or a general purpose scripting language.
 
I think it would still be limited by my shell (In a recursive function)
 
How so?
You can write the whole thing in bc.
 
8:21 PM
well I need to learn more bc then :p
 
Do you know Perl? I recall something about your having been using Perl for something a while ago, but it might be a wrong memory. Perl has Math::BigInt.
The regular integer type in Python and Ruby is a big integer type and works for this, too.
 
I'm not very strong in perl, I have done a few things with it but haven't touched it in a while
I think I almost have this bc thing down:
`seq -s "*" 1 10 | bc`
should work but I'm getting an input error
#!/bin/bash
sum=0
var=$(echo "$(seq -s\* -t1 $1)" | bc | tr -d '\')
while (( ${#var} )); do
	n=${var:0:1}
	sum=$((sum+n))
	var=${var#$n}
done
echo $sum
terrible lol
 
8:37 PM
@Jesse_b echo "$(seq -s '*' 1 10)" | bc | tr -d '\' | sed -e 's/./+&/g' -e 's/^+//' | bc
My seq (coreutils) does not have a -t option...
 
yea that's similar to the bash answer on codegolf
if I do seq -s '*' 1 2 it will give:
1*2*
which was causing an error with bc
-t terminates so I have it doing
1*2*1
so that bc can handle it
$ time ./nfact 10000
149346

real	1m20.013s
user	1m17.473s
sys	0m2.261s
 
@Jesse_b Aha, my seq -s '*' 1 2 gives 1*2. Coreutils 8.29
 
the answer on codegolf doesn't need ro remove the \'s though I wonder how to get bc to work like that
Yea I just realized I have gsec on my mac
 
@Jesse_b It removes it with sed later.
 
ah
 
8:49 PM
Wait. No.
Ah, since bc can read its own output, it does not need to be removed.
But the + can't be the last character on the line, so that's what the sed does in that solution.
Or something.
It changes \+ to `+\`. (broken markup, sorry)
 
facsum() { bc<<<"n=$1"'; fac=1; for(i=2;i<=n;++i)fac*=i; for(sum=0;fac>0;fac/=10)sum+=fac%10; sum'; }
 
:-O
hah
I'm running tests on these with really large numbers and my laptop fan just spun up full speed
$ time ./nfact 10000
149346

real	1m20.823s
user	1m18.087s
sys	0m2.343s
$ time gseq -s\* 10000 | bc | sed -e 's/./+&/g' -e 's/^+//' | bc
149346

real	0m1.305s
user	0m1.306s
sys	0m0.011s
$ time facsum 10000
149346

real	0m38.853s
user	0m38.576s
sys	0m0.082s
so @Kusalananda's solution is only slightly faster :-P
 
For simplicity you might consider testing versions that just compute the factorial; that (and not the summing of the digits) is the slow part.
 
9:05 PM
I'm just messing around out of boredom anyway
 
Your benchmark is fine. As I typed that and pressed enter I didn't know you'd done it yet.
I mean, you should do at least several runs if you want a reliable result.
 
I don't want to overheat my macbook :p
 
Ah.
 
my while loop is super inefficient it seems lol
 
I'd hope your computer could take it. But I don't want to tell you that it wouldn't have overheating problems. I'm in no position to know what considerations might apply to your machine.
 
9:07 PM
hah, yea it should be fine I was just joking since it did make the fan start screaming during that run though
 
I mean that it could avoid being damaged or crashing. Not that it could run your bash while loop fast. :)
Well... do you feel like testing some more implementations, then? Please do feel free to say no! :)
 
I think it's no competition though, mine runs in 1m+ and Kusalananda's ran in 1s
 
It is quite impressive, yes.
 
$ time ./nfact 8000
115974

real	0m48.495s
user	0m47.257s
sys	0m1.009s
$ time facsum 8000
115974

real	0m23.675s
user	0m23.509s
sys	0m0.054s
$ time gseq -s\* 8000 | bc | sed -e 's/./+&/g' -e 's/^+//' | bc
115974

real	0m0.848s
user	0m0.849s
sys	0m0.009s
 
I had expected loops in bc to be faster... but I was mistaken.
 
9:11 PM
bc is pretty impressive
 
It is. Also I wonder if I could write it better. I'm not very adept with bc.
I wrote Perl, Python, and Ruby scripts too. On my machine, with 10000, Kusalananda's solution runs about as fast as my Perl solution. My Python and Ruby solution run faster. I didn't test very rigorously though.
#!/usr/bin/env perl

use strict;
use warnings;
use feature qw(say);
use List::Util qw(sum0);
use Math::BigInt;

for my $n (@ARGV) {
    my $factorial = Math::BigInt->new($n)->bfac;
    say sum0(split //ms, $factorial);
}
#!/usr/bin/env python3

import math
import sys

for n in sys.argv[1:]:
    factorial = math.factorial(int(n))
    print(sum(int(digit) for digit in str(factorial)))
#!/usr/bin/env ruby
$VERBOSE = true

ARGV.each do |n|
  factorial = (2..Integer(n)).reduce(1, :*)
  puts factorial.to_s.chars.map(&:to_i).reduce(0, :+)
end
I hope nobody's too mad about that huge wall of totally ungolfed code.
 
9:36 PM
Well, not a huge wall. Also, why has everyone gotten so quiet... :)
gseq is just the seq from GNU coreutils, and thus the same as seq on most GNU/Linux systems (like the Ubuntu 16.04 system I'm using now), right?
 
Correct
When you brew install coreutils on mac it adds them all with a g in front
 
Ah, right. Like gls.
 
$ /usr/local/bin/g[ true ] && echo yes
yes
 
9:54 PM
for util in /usr/local/bin/g*; do
	if [[ -f $util ]]; then
		aname=$(basename "$util")
		alias "${aname#g}"="$util"
	fi
done
I don't think that worked
duh I need to source not run
 
10:42 PM
What does this file do? It's an executable in /usr/local/bin
```
#!/usr/bin/env node

require('../learnyounode').execute(process.argv.slice(2))
```
 
it will load that ../learnyounode file and strip your first two arguments (which in node will be the path to node and the path to the script)
 
so it goes up a directory to find that file right? I can't find that file. It doesnt matter what dir I'm in when I call the executable and I don't see that file in /usr/local? @Jesse_b
 
it should, I am still very new to node...halfway through an online course for it :p
 
got it thanks @Jesse_b. Im about to start the learnyounode tutorial and I'm trying to figure out a way to make it work without installing the npm package globally.
https://github.com/workshopper/learnyounode
 
@JBallin NP, looks cool I'll have to look into that once I can motivate myself to start learning it again lol
 

« first day (2751 days earlier)      last day (2194 days later) »