« first day (2798 days earlier)      last day (2454 days later) » 

09:25
I think I finally got my head around file descriptor juggling. It only took me 25 years...
 
5 hours later…
14:15
@Kusalananda Now you can start performing at the file descriptor circus
14:55
@Jesse_b exec 3>&1; echo 'Yay!' >&3; exec 3>&-
@Kusalananda I actually ran that, but as user.
Because one should not run things as root if possible.
@FaheemMitha I’m pretty sure you’d be just as annoyed if we got you to run rm -rf ~ as your user
@StephenKitt Probably. But I don't think even @Kusalananda could disguise that as something harmless looking.
@Jesse_b Nice try. But not subtle enough.
And who is Mr. Odus?
Hmm, apparently someone on SE - stackoverflow.com/users/411127/mr-odus
@StephenKitt That's definitely more subtle.
Though really guys, you should delete these things from chat. Someone might try to run them. You never know. At least the obfuscated versions. Or @terdon can do the honors.
15:09
I deleted @Jesse_b's. That was too clever by half! Took me a few seconds to figure it out :)
Eeek!
There goes Stephen's!
(sorry, reading the transcript in order).
Lol, sorry
Thanks, @terdon. I know we can always count on you.
Aww... I missed fun and games... :-(
Mine was just a bit of juggling.
Did I mention I'm returning my Zoom H5? I'm not happy about it, but it seems likely it's defective. It isn't recognizing a micro-SD card. One which came with the device, and another one (albeit a cheap one), which I purchased for testing. Also, it hung hard when it was trying to deal with the (possibly) defective cards. Even the power switch would not respond. Which seems to me a sign of something wrong.
But it seems, judging from the silence in various quarters, that sound recorders are not commonly used things, unlike, say cell/mobile phones.
I even posted on Sound SE. sound.stackexchange.com/q/44401/24842
If the user profile is not clickable, I take it that means that he/she is not registered.
If they figured a way to get sound recorders to run shell script, then I suppose it would be more interesting here, at least.
15:24
@terdon censorship! :-P
if I was American I’d get the constitution wrong and berate you about my first amendment rights
@StephenKitt Get the constitution wrong? You mean the constitution doesn't support your right to type anything online?
@FaheemMitha lots of people whip out the first amendment whenever anyone tries to remove anything, or tell people what they’re allowed to say or not
but the first amendment only limits what the government can do
@StephenKitt At least they've heard of the constitution. That's something.
@StephenKitt Oh. But there is something about freedom of speech too.
@FaheemMitha yes, that’s it
Oh, no. That one is the freedom of speech one.
Right, it's about what the govt can or can't do. Puts no restrictions on private entities.
Which is kind of a bummer. That means a private entity can do anything it wants within its limits?
15:35
@FaheemMitha That's freedom
You have the freedom to say whatever you want and I have the freedom to not interact/do business with you if I don't like what you say
@Jesse_b I suppose. I was thinking about, like corporations. Who are apparently now officially people.
Some of them are big enough that they can be quite hard to get away from.
15:47
@StephenKitt Hey man, you have the right to arm bears!
16:32
@StephenKitt I take it your presumably extensive collection of hardware doesn't include sound recorders?
@FaheemMitha not dedicated sound recorders
@StephenKitt As opposed to?
@FaheemMitha audio players and phones which can record sound
@FaheemMitha Computers?
even my old Creative DAP can record
16:41
@StephenKitt Oh. Audio players can record? Though I suppose they don't have particularly good recording equipment.
@Kusalananda Not without mics.
@FaheemMitha some can, if you plug a microphone into them
@FaheemMitha strictly speaking speakers are also mikes and can be used to record
@StephenKitt Ok. But I suppose they wouldn't normally include a mic.
@FaheemMitha no
but phones do
@StephenKitt Really? I didn't know that.
@StephenKitt Sure.
BTW, haven't see Anthony (@derobert) around for quite awhile.
Has anyone? He's still idling here, though.
Last answer April 27th.
17:38
@FaheemMitha mic's can also be used as speakers, though not very good ones
@Jesse_b I didn't know that either.
@FaheemMitha The sound will be very distorted and the mic will likely "blow out" quickly depending on the amount of power being put to it, but it is essentially a very small speaker
@Jesse_b "blow out" as in be destroyed?
@FaheemMitha Correct. Like when you connect a low wattage speaker to a higher rated amplifier
@Jesse_b Well, I must remember not to do that, then.
Looks like I'm the only one missing Anthony.
@Jesse_b Btw, related to something we were talking about the other day - rollingstone.com/politics/news/…
But you may already have seen it.
Matt Taibbi kind of specialises in bank exposes. When I saw that it was in Rolling Stone, I thought it was probably by him. Incredible the kind of things you can get away with if you have a sufficient amount of privilege.
I have not seen that but when I worked for a bank I remember HSBC getting in trouble for laundering
@Jesse_b Not much trouble, it seems.
@FaheemMitha Yeah...I just want to move into the mountains and leave society behind
@Jesse_b I hope not literally.
One really has to admire Taibbi. He really pulls no punches. All hail to free speech, American style.
17:58
@FaheemMitha Yes literally. People are the worst
@Jesse_b Some of them are.
It sounds like you're trying to be more cynical than me. I really don't recommend that, for your mental health. You'll fall off the edge of the world.
Funny thing about Taibbi. He's not really an intellectual. He's what one might call an Regular Joe.
I think people underestimate the intelligence of the "regular joe"
@Jesse_b I didn't mean it like that.
It wasn't a criticism. But most of the people who do that kind of thing for a living are fairly "intense".
Though I've never met any of them.
The closest is Kobi Snitz. I might have mentioned him. We were together for one year in grad school at UNC.
He's now in Israel doing activism. Some of it sounds pretty dangerous.
Israel in general seems like a pretty dangerous place
@Jesse_b I think it can be, but I don't know.
But Kobi is an Israeli who is doing activism in support of the Palestians. A pretty dangerous thing to do. Admirable, of course. But personally I'd be more interested in not becoming dead.
Anyway, he's probably the closest I've come in my life to activism and so forth. I don't get out much.
I'm kind of surprised this answer only has one upvote.
1
A: Text annotations and image additions to PDF file using free software

Faheem MithaA good choice for annotation is TeX, specifically LaTeX in conjunction with the LaTeX package pdfpages, and the drawing package TikZ. An example script follows. This is the overlay of the two page document text.pdf. The command \includepdf from the pdfpages package is invoked with the pagecomman...

TeX is probably the best option for PDF annotation if one wants power and precision/accuracy. Assuming you're not in a hurry, of course.
18:47
is it possible to sort an array of numbers
$ arr=(1 1 1 2 2 2 3 30)
$ sort -r <<<${arr[@]}
1 1 1 2 2 2 3 30
well I guess I can use printf
@Jesse_b Yes, you have to give sort lines to sort.
@Kusalananda I was hoping to use string redirect
didn't like this either:
$ IFS=$'\n' sort -r <<<"${arr[*]}"
1 1 1 2 2 2 3 30
$ printf '%s\n' "${arr[@]}" | sort -rn
30
3
2
2
2
1
1
1
$ sort -rn <<<$( printf '%s\n' "${arr[@]}" )
30
3
2
2
2
1
1
1
$ ( IFS=$'\n'; sort -rn <<<"${arr[*]}" )
30
3
2
2
2
1
1
1
18:57
sort -rn < <(printf '%s\n' "${arr[@]}") as well
The IFS has to be set for the shell to join on the first character of it.
That's why IFS=$'\n' sort -rn <<< ... does not work.
IFS is being set <strike>too late</strike> in sort's environment.
Booo, I want to do strikeouts.
awk is strange
nvm, user error
I made a script to test the randomness of RANDOM
#!/usr/local/bin/bash
mnum=$1
mrun=$2
run=0
arr=()
while ((run<=mrun)); do
	arr+=($((RANDOM % mnum)))
	((run++))
done
sort -n < <( printf '%s\n' "${arr[@]}" ) | uniq -c | awk -v max="$mrun" '{print $1,$2,"-",$1/max*100"%"}' | column -t
19:25
@Jesse_b Why not get rid of the array and just pipe the loop into sort directly?
because I'm not a very smart man :p
RANDOM seems pretty reliably random though
@Jesse_b What is the use case?
@FaheemMitha boredom
XY-questions? Pffft... Working on an XYZ question!
19:34
@Kusalananda Huh?
Glad to hear about Palestine. That too in thses days after 51 years of six day war.
@FaheemMitha See the comments to this answer: unix.stackexchange.com/a/448496/116858
@PrabhjotSingh Pardon?
@Kusalananda X being:
For git blame -L "$NUMBER" and that's it — Jim 3 mins ago
presumably.
Still not clear exactly what he's trying to do.
Obviously it's rarely applicable to production issues but I don't always like the "programmer" hate for doing things the hard way
Sometimes taking the long way is simply more fun
Thanks for whoever here did all the upvoting.
I'm guessing it was one person.
19:43
darn, I was trying to downvote. Must have hit the wrong button :-p
@Jesse_b Oh, was that you, then?
I can neither confirm nor deny these accusations
It's not an accusation.
@FaheemMitha I sometimes think you take me too seriously >.>
@FaheemMitha glad to hear that some people are active in support of Palestinian and that if Palestine cause is still alive.
19:46
@Jesse_b You forget tone and so forth doesn't come across in text.
@PrabhjotSingh Well, me too, I guess. Though those people have certainly been through a lot of horrible stuff. And more to come, I expect.
@FaheemMitha Yeah but I'm a knucklehead, I should rarely be taken seriously
@FaheemMitha last year's newspaper thehindu.com/opinion/op-ed/…
It seems like a regular feature of the news. For the last however many years.
@PrabhjotSingh I just skimmed that, but it looks accurate.
This year none remember s six day war
In popular media at Least
Actually, speaking of Kobi, I once had a chat with him and a friend of his (who I knew slightly). She just popped on in my Linkedin page, but I've now forgotten again.
Anyway, they're both Jewish, and I sort of assumed that they would be at least neutral towards the whole Israel thing, so I was a little surprised to learn that they thought the whole thing was quite horrific. Not on those words, obviously. I don't remember the details of the conversation.
To be clear, the foundation of Israel, and everything that followed.
19:52
I can't tell you in words how happy I am. Syrian and Iraqi mess was created to help this nation.
@PrabhjotSingh I wouldn't have been able to tell you the details either, if asked.
@PrabhjotSingh Happy about what? It's a horrible thing.
@FaheemMitha happy that one of our brothers is supporting Palestinian people.
I mean, if someone said Six Day War to me, it would ring a bell. And I would know it was an Israel thing, but I wouldn't be able to tell you what it was.
@PrabhjotSingh One of our brothers?
You mean Kobi?
@FaheemMitha I mean your friend
> Third, it turned Israel into an American asset in West Asia. The United States realised the true strategic potential of Israel only after the June War.
19:55
@FaheemMitha if you support Palestinian cause you are my brother
@FaheemMitha Q1: "unquoted word in result from grep is being split into two" Q2: "this is part of grepping output from diff" Q3: "I'm doing this to get line numbers for additions to a file" Q4: "I need the line numbers to run git blame -L"
Interesting, Chomsky said exactly the same thing. But maybe it's conventional wisdom.
@PrabhjotSingh Right, you mean Kobi.
You could always write to him and tell him so. I'm sure he's like to hear that.
@FaheemMitha So that makes it an WXYZ-question.
@Kusalananda He wanted the beginning and ending line numbers for some range?
@FaheemMitha No. What he wants is to see who added a particular line in a particular revision in a git controlled file.
19:59
@Kusalananda Oh. In that case. Just do /word_or_string_I_want in the buffer, assuming that git blame used less, which it probably does.
If he has to ask a question about that, I'm surprised he gets anything done.
At any rate, that's what I do in Mercurial.
20:44
@PrabhjotSingh I'm surprised you care about the Palestinians. Most people don't. At least, not in India.
@Jesse_b Did you try on a Mac? (the grep Q)
$ /usr/bin/grep "$(/usr/bin/grep '<appointment-id internal:ref=1.2.3/>' test.xml)" test.xml
    <appointment-id internal:ref=1.2.3/>
$ /usr/bin/grep --version
grep (BSD grep) 2.5.1-FreeBSD
Good, thanks!
np
I can reproduce if I modify the input file based on ilkkachu's comment
Adding a [z-a]?
20:49
$ cat test.xml
<note>
    <to>Jim</to>
    <from>John</from>
    <heading>Reminder</heading>
    <body>Some text</body>
    <appointment-id internal:ref=1.2.3/>[z-a]
</note>
$ /usr/bin/grep "$(/usr/bin/grep '<appointment-id internal:ref=1.2.3/>' test.xml)" test.xml
grep: invalid character range
I wonder if he has <appointment-id internal:ref=[something]/> and he's redacting it
unlikely because I would imagine the test.xml is already redacted test data
@Jesse_b That's a good point.
Yeah when he copied it directly from the post it looks like it didn't find anything
nvm I read that wrong
Glenn Jackman nailed it I think.
20:57
yeah sounds reasonable
Does anyone here use Skype on Linux?
@Jesse_b I'm still a bit mystified by the extra set of + in his set -x output...
21:16
@Kusalananda I think because he was running the commands via a script
@FaheemMitha I don't
21:28
@Jesse_b Well, I did too...
$ ./script.sh
++ grep '<appointment-id internal:ref=1.2.3/>' test.xml
    <appointment-id internal:ref=1.2.3/>
+++ grep '<appointment-id internal:ref=1.2.3/>' test.xml
++ grep '    <appointment-id internal:ref=1.2.3/> ' test.xml
    <appointment-id internal:ref=1.2.3/>
++ exit 0
maybe it's a mac thing?
22:05
@Kusalananda: Looks like Jim finally took your advice

« first day (2798 days earlier)      last day (2454 days later) »