« first day (3097 days earlier)      last day (25 days later) » 

1:53 AM
@DJMcMayhem Thanks
If anybody here wants to solve a puzzle, go to randomstuffonline.com/puzzle1.html
 
 
2 hours later…
4:04 AM
@Adám (4/2)a
 
 
5 hours later…
9:22 AM
CMC: Print some perforated paper:
| - - - - |
|         |
|         |
| - - - - |
Inputs: number of sheets, distance between horizontal rows, number of -s on each horizontal row
 
@Neil distance between horizontal rows? Can you show result of sheets:2, distance:3, minuses:4?
 
@Adám hmm, well, I was thinking my original example would be distance:3 minuses:4 but I would also accept
| - - - - |
|         |
|         |
|         |
| - - - - |
|         |
|         |
|         |
| - - - - |
 
@Neil but would also accept…? I suppose your original example was 1 3 4, and ^ is 2 3 4.
@Neil Can we take distance as including the perforation line, i.e. these examples have distance 4? (essentially 1-indexed instead of 0-indexed). If so:
@Neil APL (Dyalog Unicode), 32 bytes 1⌽'|| ',⍤1↑a,⍨,↑⎕⍴⊂⎕↑a←⊂∊⎕⍴⊂'- 'Try it online!
 
9:38 AM
@Adám my second example was meant to be 2 4 4 but you can call it 2 3 4 if you prefer
 
@Neil Ah, then my code is spot-on.
 
lgtm
 
@Neil Want an explanation?
 
don't worry
 
 
1 hour later…
10:52 AM
@Neil Canvas, 19 bytes. SOGL had a nice built-in that's very helpful for this ("A", "B", 4 → "BABABABAB") that i've for some reason have not added to Canvas..
 
11:03 AM
@Neil SOGL, 16 bytes
 
11:30 AM
(the base tissue is damn impossible to create using reflections or rotations :/)
 
it's not impossible but it turns out to be 3 bytes longer
 
@Neil Canvas, 18 bytes using reflections
17 bytes taking the first input incremented
15 bytes also taking the 2nd input incremented; yay beat SOGL
 
12:00 PM
so you're inputting the number of spaces instead of -s?
 
@Neil what I'm inputting is the length to which to mold " -", to palindromize with 1 overlap later
 
12:13 PM
@Neil um... don't you need to, like, put the cursor at the center?
(which might not exist)
 
@dzaima actually 14 bytes by not using overly-fancy features not needed here
11 bytes by finally figuring out how to output the last line in less than 5 bytes
 
 
1 hour later…
Couldn't think of a cheap way to restructure it to only build the current line once
 
@Neil oh hadn't thought of using ReflectOverlapOverlap
but yeah, it's longer
 
CMC: IP address in quad-dotted notation as text → binary ("01" string or [0,1] list or [false,true] list etc.) E.g. "172.16.254.1"10101100000100001111111000000001
 
1:44 PM
Heh, for "source should work in multiple languages", I'll just do PS v5 and PS Core
 
@Adám JavaScript, 57 bytes
@Adám APL, 20 bytes
 
@dzaima So far, I have one less than that.
 
1:59 PM
I've got 22 in APL
@Adám I managed a 19-byter but it doesn't work as a function, sadly
 
19 using that cheaty function thing
 
@dzaima I have 19 as proper tacit function.
 
@Adám A whopping 80 bytes in PowerShell doing it the "proper" way.
 
Found 18 as tradfn body.
 
@Adám Canvas, 12 bytes - pretty much my JS answer
 
2:16 PM
Hmm, wonder if a simple "Interweave A..Z with z..a" challenge would go over well.
 
@Veskah So a constant output (i.e. KC challenge) or interleave a string with its reverse?
 
Leaning towards the former
 
@Veskah Seems a lean for main. Maybe CMC it?
@Veskah 8 bytes in Extended Dyalog APL.
 
i'm realizing i don't have a flatten (monadic ,) builtin for canvas..
 
2:22 PM
@AdmBorkBork Ah, well there we go
Ha ha, typing up the CMC wrong
CMC: Interleave A..Z with z..a. I.e., generate AzByCxDwEvFuGtHsIrJqKpLoMnNmOlPkQjRiShTgUfVeWdXcYbZa
There we go
 
@Veskah Canvas, 7 bytes
:51124327 oh whoops, left the input there :p
 
@Veskah APL (Dyalog Extended), 8 bytes (,⍪,⌊)⎕A TIO
 
Yeah, I actually thought the right pane was output so I was confused
 
@Veskah PowerShell, 47 bytes
 
@Adám you forgot the reverse part
 
2:29 PM
@dzaima Oops.
 
Ruby: [*?A..?Z].zip([*?a..?z].reverse).join
 
@Veskah APL (Dyalog Extended), 10 bytes (,⍪,⌽∘⌊)⎕A TIO
 
Numbers have a downto method, but strings don't.
 
@AdmBorkBork Also, heh. Didn't find that one because I searched "interweave" instead of interleaving
 
@J.Sallé ,⍉(8/2)⊤⊃⌽'.'⎕VFI⍞ Try it online!
 
2:33 PM
43 bytes using char range
 
lol
ey
 
@Veskah APL (Dyalog Extended), 9 bytes ,⎕A,⍪⌽⌊⎕A TIO
 
lol
During the 1.5 year gap, I remember you all, but I forgot how to code golf
dammit facepalm
 
2:38 PM
@lol pick a golfing language, smash the keyboard at random, see what output it produces, ???, profit
 
lol
ehh
choosing C++ as my language was a terrible idea
 
@Veskah That means you can use the char range to get to 36 bytes
 
noice
 
CMC: One of your current IP(v4) addresses. E.g. I get 10.136.6.86 or 10.136.14.189 on TIO.
 
lol
@Adám Sike, That's completely impossible in C++ without intensive use of libraries
waiitt
 
2:44 PM
@lol You could call a different language to do the job for you…
 
lol
oh
Bash, ip -a 5 bytes
 
@lol doesn't seem to work on Try it online!
 
lol
jk
 
I think Get-NetIPAddress is sandboxed away in TIO
 
@lol Doesn't work on my computer either (though I'm on Windows 10, so MMMV).
 
lol
2:47 PM
waiit
 
"127.0.0.1" -- 11 bytes in a lot of languages
 
@AdmBorkBork Forbidden loophole.
 
lol
ipconfig or ifconfig
 
@lol That prints too much.
 
require'socket';Socket.ip_address_list.find &:ipv4?
s/find/select/ gets all of them
 
lol
2:52 PM
ip a in linux, although it still prints too much
but still it prints your ip
in all ways
 
s/fi.*/[0]/ grabs my IPv6 address first.
 
lol
what about [1]
 
@Adám I've absolutely no idea what ⎕VFI does
 
My four IP addresses are: IPv6 WiFi; IPv4 WiFi (local); IPv6 loopback; IPv4 loopback
 
I had ∊2⊥⍣¯1⍎('\.'⎕R' ') but as I mentioned, it doesn't work as a function
 
2:59 PM
Getting an ethernet cable between my laptop and my router would be a nightmare, not to mention my lack of ethernet cables in the first place.
 
@J.Sallé that expects there to be at least one number ≥128, and you also need a before
 
Not that I couldn't just carry it to the next room for a few minutes, but I'd have to unplug my VGA monitor, which would prompt Windows to rearrange all my windows
 
lol
ip -4 a show eth0(Ethernet, IPV4), ip -4 a show wifi0(Wifi, IPV4) (Both linux)
(Try with WSL on windows)
but if you want them ALL, its just ip a
4 bytes, simple
It doesnt work with bash because it needs proprietary software present on some (or most, if you say) linux distros
 
0
A: Sandbox for Proposed Challenges

A__Shortest code to produce a self-reproducing list, dictionary, array, etc. Write the shortest code to produce a nested list, dictionary, array, etc. That is, when you index one of its items, you get the same result. Try this in a Python REPL: >>> i=[] >>> i.append(i) >>> i [[...]] >>> i[0] [[......

 
CMC: find a public IPV4 address with all four bytes < 128 that responds to HTTP
 
3:09 PM
@JohnDvorak 1.1.1.1
 
Nice. Is that a public DNS?
 
lol
@JohnDvorak yep
cloudflare
also, 8.8.8.8
9.9.9.9
 
I can't get 8.8.8.8 to respond to HTTP
 
lol
each for Google, and Quad9
oh
wait
I only pinged
(facepalm)
 
1.1.1.1 works though
 
lol
3:11 PM
oh
but how
oh I see
1.1.1.1 has a website hosted on its ip itself
 
It's a pretty fast response, with a pretty but content-wise barebones advertising for their own mobile app
 
lol
yep, and it's also their DNS address!
(Primary: 1.1.1.1 Secondary: 1.0.0.1)
they are boasting speed, and it really is fast
but not so compatible
 
I guess the app does nothing but reconfigure your network settings and show ads?
 
@JohnDvorak the android app creates a vpn (because otherwise DNS requires static IP configuration on every hotspot which might be a big hassle, and requires doing so manually), but otherwise it doesn't do much (i haven't seen any ads anywhere from the app)
 
Thanks
Does it actually improve net speed, and does it cooperate with Blokada?
 
3:23 PM
@JohnDvorak i haven't tested speed because i'm lazy, and i didn't know Blokada existed :p
from the sound of it, shouldn't blokada allow you to change the DNS anyway?
and from the looks of it, Blokada already defaults to using 1.1.1.1 & 1.0.0.1 :P
 
Ah, good catch. Let's see if I notice any speed difference.
It defaults to the servers preset by DHCP.
 
@JohnDvorak ah, okay. 1.1.1.1 still is on the list though
 
Yep. Listed under C.
 
oh, Blokada doesn't seem to be using https or TLS for DNS
 
3:58 PM
@J.Sallé Verify and Fix Input; see Lesson 12 (about 9/10 down).
 
 
2 hours later…
5:35 PM
^ Probably invalid
 
@MilkyWay90 Why?
 
@Adám Too software-dependent
You also can't have Ethernet
 
@MilkyWay90 Can't you just look for \d+\.\d+\.\d+\.\d+ in ipconfig's output?
 
@Adám It's more bytes but if it makes it valid, sure
 
@MilkyWay90 Is there no way to call an OS command and capture the output without going via a file?
 
5:41 PM
@Adám Not that I know of
But I'll look it up again
746
Q: Running shell command and capturing the output

Silver LightI want to write a function that will execute a shell command and return its output as a string, no matter, is it an error or success message. I just want to get the same result that I would have gotten with the command line. What would be a code example that would do such a thing? For example: ...

Wow, I got lucky
@Adám Is an output of b'<insert ip here>' accepted?
 
@MilkyWay90 Is that because it is returning a special type of string?
 
@Adám Yeah
A bytes-like object
 
@MilkyWay90 Sure, we always allow returning a value instead of printing it, if nothing else is stated.
 
@Adám Okay, so it should be a function, right (if it is a special type of string)?
 
@MilkyWay90 I suppose.
 
5:55 PM
Okay
 
@MilkyWay90 \d+(\.\d+)+
 
@Adám ok thanks
I'm not good with regex
 
@MilkyWay90 Neither am I, just the basics.
 
If regex objects are allowed as output ^
It gives an output of <_sre.SRE_Match object; span=(363, 375), match=b'192.168.56.1'>
 
@MilkyWay90 Yeah, I just tried it. Nice.
 
5:59 PM
But when I try to do .match on it, it gives an error
AttributeError: '_sre.SRE_Match' object has no attribute 'match'
 
@MilkyWay90 IANAPP \○/
 
@Adám I Am Not A Python Programmer?
 
@MilkyWay90 Right.
 
ok
@Adám Luckily, the answer is the second search result on the web
It's 99 bytes if regex object outputs are not allowed
 
Sub-100. Still counts
 
6:07 PM
Okay, I think this is the lowest I can golf it without changing my strategy completely
I have a solution for 93 bytes
just have to get to 90 bytes
I may have found a golf
That's right
72 bytes
From 101 bytes to 72
 
6:30 PM
I'm using a LinkedHashMap in Java initialized to use accessOrder. In rare scenarios in a multi-threaded environment I've gotten into a state where issuing a remove on the map completes successfully but the entry is still in the map... The accessor methods to manipulate the map are all synchronized. Has anyone run into this before?
I don't believe the map needs to be volatile because the map's reference is never changing
Doing a heap dump doesn't appear to show any rogue copies of the map
I cannot reproduce this on command
 
I'm not good at Java
 
7:25 PM
1
A: Sandbox for Proposed Challenges

VeskahInvert Some Switches on a Switchboard Inspired by this challenge. Goal: Given a pre-configured switchboard and a list of numbers, invert the switches at the given indexes. A switchboard is made up of some number of switches (v or ^) arranged into rows of varying length wrapped in -s. Here is ...

 
@NewSandboxedPosts Please (no)? bully
 
Oh, messed up that regex. Should be Please (no )?bully
 
um... still can't understand
 
Just a request to give feedback in the manner of "(optionally don't) bully this post"
 
7:38 PM
uh... we don't bully others here, unless it's some form of joke I can't understand
 
It's fine, my post doesn't have any lunch money to take. (It's meme born from a Chinese cartoon, don't worry too much)
 
8:03 PM
Hi
I have two sorted lists A and B of numbers. I want to associate each number in A with a different one in B so that the sum of the distances is minimised. Is this hard?
the number of numbers in B is more than in A
 
8:28 PM
Hard as in computational complexity, or as in ease of just writing something to do it? For just writing something to do it it wouldn't be hard to just disregard the sortedness and brute force it in factorial (?) time, but it's probably possible to do more efficiently
 
A = [1, 2] and B[0,1, 10000] is a tricky example
if we map 1->1 then we have to map 2->10000
@UnrelatedString I meant something that can be coded to run fast
 
So yeah it's probably possible to do faster than factorial time
 
@Anush Why can't 2 be associated with 0? Does order need to remain preserved?
 
Order shouldn't have to be preserved but it intuitively seems like assuming that order is preserved would be optimal--there's probably some obvious counterexample though
and if you're greedily matching 1->1 then it is clearly a very bad idea to assume that
but I'm guessing that the greedy approach is just not going to work generally
in this case 1->1 2->0 has the same sum of differences as 1->0 2->1 but I'm not sure about other cases
I also don't really have any formal training in algorithms so I'm not exactly an authority on this lol
 
8:45 PM
if that's the case then you can just keep track of the total sum of the middle and the sum of each end
then slide A across B
until it starts getting bigger
i think
something like that >.>
 
I feel like you couldn't just slide A across B, since requiring the values mapped to to be contiguous in B would provide a terrible result for A=[2,99] B=[2,42,99], but sliding smaller parts of A around seems to be the general idea of it
 
@Veskah Charcoal, 8 bytes: ⭆⮌β⁺§ακι
 
For the first time I had to create 11 different units for a single task in Delphi. Saved everything, pressed compile, waited for 15 minutes. Delphi couldn't handle its units, BSODd my computer.
If I ever tell you guys it's good to work with Delphi, please refer me to a hospital.
 
wow
Anyhow maybe one approach could be to just go through every element of the powerset of B that has the same length as A, but I'm not really sure about how fast that would be
 
@UnrelatedString that's why i asked the first question
if that's the case, though you still could use backtracking instead of straight up brute force
 
8:55 PM
I think there's no obligation for order to be preserved
 
since as soon as you get a higher sum than your current best, you can stop processing that option
 
but it seems like there's no time that breaking order will actually do strictly better than preserving order
yeah
 
@Poke order has to be preserved
it feels like there is a dynamic programming solution
 
i'll agree to that
 
but how exactly?
 
9:03 PM
CMC: Given a string of printable ASCII, return every letter that doesn't appear in the string. You may return these letters as upper or lowercase, but you must detect letters of both cases in the input string
 
oh and.. is pomegranate the module of choice for HMMs these days?
 
@DJMcMayhem dzaima/APL, 4 bytes
 
I thought I had 5 bytes in Brachylog, but I forgot how weird x is
 
@DJMcMayhem ^^ same in Extended Dyalog
@DJMcMayhem Now let's do the same for the entire UCS.
 
Ooof
 
@DJMcMayhem (∊'\pL'⎕S'&'⎕UCS⍳2E5)~⌈ works :-)
 
@Adám What is the range of code points in that?
A Brain-flak answer doesn't sound too hard (ironically, probably easier than the original CMC)
 
@DJMcMayhem up to 2E5, the last letter in Unicode being 195101
 
9:35 PM
 
s/\<or\>/xor/
 
@EriktheOutgolfer ? oh.
 
 
2 hours later…
11:32 PM
@DJMcMayhem Charcoal, 7 bytes: Φβ¬№↧θι
 

« first day (3097 days earlier)      last day (25 days later) »