« first day (2135 days earlier)      last day (2694 days later) » 

8:04 PM
\o/ i found regex 101 source
 
8:14 PM
@Downgoat What version of Git is on the TF2 server
If any
 
2.1
 
Does the plugins/tf2goat not have the remote set up or something
Because things aren't working
 
yes it does
you must have merge conflic
add -X ours -m "Updated from remote"
 
It shouldn't have a conflict. The only thing it could conflict on is the config which is ignored
Move config.json out, reclone the entire repository, and move it back.
 
best solution is to just run git fetch; git rebase origin/master -X theirs -m "Updated from remote"
no way that won't work
try that
i run that and it work
 
8:18 PM
...
 
?
 
The config.json is in the .gitignore. It can't cause merge conflicts
source: everything worked on my machine
 
well then your git plugin is borked
maybe you need to set the thing to correct WD?
 
That's what the -C is for
Tell you what I'll run !pull. Can you check the console?
 
one sec
@quartata okay
yes, i was right :D
you need to add -m or at lesat strategy
 
8:21 PM
Can you show the output?
 
it is nano with default merge message
 
??
It returned with 128
Is this some weird Git 2.1 thing
 
waaat
 
I have Git 1.9.1
I've never needed to add a message when I pull
 
that because conflict
 
8:23 PM
There can't possibly be a conflict
 
git pull = evil too
 
Unless you edited tf2goat.py
 
yes i did
there was some bork
 
Why did you edit it
 
17 secs ago, by Downgoat
there was some bork
 
8:23 PM
@DJMcMayhem :D yay!
 
Can you at least show a diff
 
okay
 
You could have opened an issue you know :P
 
@EᴀsᴛᴇʀʟʏIʀᴋ I'm not sure which message you're responding too...
Hats?
 
I tested everything so I'm kind of curious how you borked
 
8:24 PM
diff --git a/tf2goat.py b/tf2goat.py
index 7642b5b..5290f6c 100644
--- a/tf2goat.py
+++ b/tf2goat.py
@@ -58,8 +58,8 @@ def load():
   GameThread(target=f).start()

 def unload():
-  room.leave()
   client._request_queue.queue.clear()
+  room.leave()
   client.logout()

 def on_se_chat_message(msg, _):
@@ -107,7 +107,7 @@ def command_dispatch(cmd, sender):
   elif cmd[0] == "!players":
     msg = "\n".join("%s - [%s](steamcommunity.com/profiles/%s): %s kills/%s deaths" % (
       "RED" if p.team == 2 else "BLU" if p.team == 3 else "SPEC",
 
Those are the changes I committed
What the heck
Can you just manually pull with -X theirs
 
i added commit with me adding config stuff
 
gets popcorn
4
 
But the config is all in config.json
and it's ignored
 
@DJMcMayhem ye
 
8:26 PM
i made commit before you did thing
 
But yay to whatever else too
 
i did git rm --cached config.json so no more bork
 
wat
can someone please test out my URL shortener by going to dk0.us/3
 
@wat redirection error
 
wat
@flawr huh?
what is that supposed to mean/
 
8:34 PM
@wat infinite redirection
 
@wat Works.
 
wat
@mınxomaτ :)
 
You should upgrade nginx btw, 1.11 is out.
 
wat
@mınxomaτ I think I just did
 
8:38 PM
Well, no, see the screenshot.
 
wat
no, like I literally just ran an upgrade
 
Still shows the same.
You need to run sudo add-apt-repository ppa:chris-lea/nginx-devel first. ubuntu repos are outdated.
 
Question: how to get package in apt default repos
 
Get approved by Debian upstream.
 
wat
@mınxomaτ Do I have to upgrade?
 
8:40 PM
@wat There are quite a few fixes and better HTTP/2 performance in 1.11
 
@mınxomaτ is that hard :/
 
Yes.
Your own PPA really is the way to go.
 
:(
 
wat
@mınxomaτ Why sudo?
 
Reflex
 
Well these are some really stupid claims.
There are a few common sense points, the rest are basically personal opinions.
 
8:58 PM
@Downgoat The Linux kernel should have it own TV show then
 
Lmao XD
 
Oh hey, there's an answer on the minesweeper challenge!
 
hi!
the annoying thing about doing this in Prolog is that the actual Minesweeper-solving part of the problem is really easy
but the parser is much harder to write
 
That's too bad.
 
wat
@Downgoat Try my images againb
 
9:11 PM
I thought I was pretty open with allowed input types.
Would it be easier as a function?
 
nah, the problem is that the ideal input format specifies the number of mines on each square and the number of mines surrounding each square, specifying them as a variable if unknown, and has a border of known-nonmine-unknown-minecount surrounding the whole grid
and I felt that requiring the input to be in that form was unreasonable
 
wat
> $0.88
 
this would have been a lot easier if Prolog had basic functional primitives
but it doesn't even have map, and although it's easy to write, it cuts too much into your bytecount unless you're going to use it 3 or 4 times
maybe I should write a golfing version of Prolog with terser syntax and a better standard library (not Brachylog; I can't figure out how to write anything nontrivial in it)
 
I wonder if brachylog will dominate in this challenge
 
I'd be surprised
it's very bad at writing functions taking more than two arguments
this problem tends to require more than that
 
9:20 PM
Ugh, this test data is ridiculously hard to make
I keep fucking it up
 
PSA: JavaScript in the browser supports the ISO-8859-1 encoding.
 
@wat that is what I got when I clicked on your link
 
(source: saving a .js file in ISO-8859-1 and running it in Firefox, Chrome, and IE)
Oh come on, I can never get two consecutive messages when I try :P
3
 
@ETHproductions the struggle is real
 
web.mat.bham.ac.uk/R.W.Kaye/minesw/infmsw.pdf minesweeper is Turing-complete
 
9:30 PM
@betseg How should that work? It Minesweeper doesn't do anything without human interaction.
 
@betseg wat ^
 
@flawr So? Your code doesn't do anything without a system clock.
 
brb claiming monopoly is turning complete by writing latex-generated pdf
6
 
A turing complete system does not depend on the type of energy source. It's model.
 
So my grandpa's mechanical typerwiter is turing complete too.
And even better: My fountain pen is turing complete. (Depending on who's holding it.)
 
9:34 PM
And best: Tin cans are turning complete
(depends on the goat)
 
@flawr No, because it doesn't provide a model for running calculations. The system pen+you is TC.
 
> turning complete
 
I don't see how turning-completeness of minesweeper is even applicable
 
so, it turns out that my top two answers (100 and 25 upvotes respectively) are both 9
 
@mınxomaτ are people turing complete?
 
9:34 PM
@ETHproductions goddammit
 
Minesweeper is NP-complete, I think
(maybe even PSPACE-complete, although that would vaguely surprise me)
it's finitely large under standard rules, so wouldn't be TC without generalizing it somehow
 
@mınxomaτ How does Minesweeper do that, I mean you could click wherever you want?
 
Oct 5 at 4:50, by Geobits
Is that why cheddar wheels are so round? From being so turning complete?
 
@ais523 27
 
@flawr I'm assumed the paper provides that info. I tried to make a more general point here.
 
9:36 PM
oh, it's gone up a bit then
also, Minesweeper works computationally by allowing you to compile a program into a Minesweeper game
 
@mınxomaτ too bad there is too much I don't understand :)
 
that's truthy if there's a solution, falsey if there isn't
 
CSS is Turing-complete if user input is clicking buttons
 
no, CSS isn't Turing-complete, unless there's some way to create infinite memory inside it
I originally joined Reddit, many years ago, to debunk a claim that CSS was Turing-complete
the account's been used for other things too, but debunking the TCness of CSS is its original purpose
 
@ais523 We always mean "Given infinite time and memory, X is TC", when we say "X is TC".
 
9:37 PM
(that said, I'm not saying it can't be TC; there might be some way to do it with WebForms)
 
CSS isn't TC because it can't make looping/recursive calculations on its own, right?
 
@mınxomaτ things are only TC if they're capable of accepting more time and memory, though; for example, C is TC because it can store things on the filesystem
 
0
A: Sandbox for Proposed Challenges

SEJPMCount the reviews! code-golf array-manipulation Introduction and Credit Imagine you're Amazon. Imagine you have a large number of products for which a lot of people have written reviews scoring 1-5 stars. Now you need to give your customers a summary for each product based on the simple prod...

 
@ais523 HTML+CSS is though, right?
 
@ETHproductions you can handle loops by getting the user to click a button repeatedly (I think that's reasonable), but you have to bound the size of the loop in advance
 
9:38 PM
CSS is only TC when considering the firefox nightly beta alpha version of CSS which has regex
 
it wouldn't surprise me if it were primitive recursive, rather than TC
 
@El'endiaStarman i mean HTML can be considered TC beacuse of JS inside of it
 
@Downgoat Firefox stable has supported RegEx CSS selectors for a long time.
 
@Downgoat CSS has regex? 0_0
 
Also early IE CSS supports inline JS :P
 
9:39 PM
@Downgoat I wouldn't say that embedded JS in HTML could really be said to be part of the HTML language.
 
21
A: Is this number a prime?

mınxomaτHTML+CSS, 254+nmax*28 bytes We can check primality using regular expressions. Mozilla has @document, which is defined as: @document [ <url> | url-prefix(<string>) | domain(<string>) | regexp(<string>) ]# { <group-rule-body> } To filter elements via CSS based on the current URL. This is a si...

 
(the difference is that a primitive recursive language doesn't have infinite loops, any time you start a loop you have to declare the max number of iterations in advance)
 
That makes two TILs, the other being the JS .toSource() method
 
@ETHproductions CSS : Regex :: ES7 : Array comprehensions
 
"254+n_max*28 bytes"
that clearly can't handle unbounded integers
although as it's O(n) in length, there's clearly interesting computation going on there
 
9:40 PM
Read the comment from Dennis.
(this is unrelated to the TC discussion, it was just a reply to ETH)
 
@ETHproductions that's non-standard FF only
 
I know, like uneval
 
uneval == JSON.stringify pretty much right
 
Not quite, object literals are wrapped in parentheses and attribute names aren't surrounded with quotes
 
Idea: instead of Runtime Error i should make cheddar say BORK ALERT BORK ALERT BORK ALERT
 
9:43 PM
>>> uneval({a:1,b:2})
"({a:1, b:2})"
>>> JSON.stringify({a:1,b:2})
"{"a":1,"b":2}"
 
hm :/ okay fair
 
uneval also separates with spaces, which is occasionally useful I guess
JSON.stringify([1,2,3]) == "[1,2,3]", uneval([1,2,3]) == "[1, 2, 3]"
 
0
Q: Help! I have more homework!

Jorge PerezMy teacher was more than unhappy with my Martian Homework. I followed all the rules, but she says that what I output was gibberish... when she first looked at it, she was highly suspicious. "All languages should follow zipf's law blah blah blah"... I didn't even know what zipf's law was! It turn...

 
.toSource is quite a bit different in that it wraps the data in (new Whatever()), unless it's an array or object literal, in which case it acts like uneval
 
9:59 PM
questoin: what should i call method to join by newlines?
 
@Downgoat as a challenge title?
 
?
 
"method to join newlines" - is this a function in your code? a title for a new PPCG challenge?
 
a method in code
(for cheddar)
 
10:02 PM
@Downgoat Is it the equivalent of vim's J command?
 
uhhh?
idk
["test", "foo"] => command => test\nfoo
 
.newlines perhaps?
 
"foo\nbar" --> "foo bar"
 
I'd suggest .joinWithNewlines but that's not golfy enough
 
:O J COMMAND IS BEST THING EVER
 
10:04 PM
Lol, did you not know about that?
 
I was thinking maybe like "stack" but nah
 
@Downgoat ConvertToNewlineSeparatedList
 
.toLines?
 
@DJMcMayhem I knew about <backspace><backspace><backspace><backspace><backspace><backspace><backspace><b‌​ackspace><backspace><backspace><backspace><backspace><backspace>
@ETHproductions +1 this is good
though changing vfuse will probably break a lot of things
owell
 
Hi everyone! I have a question - if I post an asynchronous function as an answer to some code golf, should I add the overhead required to call it (in that case, Async.Start in F#) to the byte count? I could not find anything related to this topic on meta.
 
10:05 PM
@Downgoat hahaha
 
@Downgoat Perhaps leave .vfuse as a deprecated method
 
@pmbanka probably not. In general, just defining the function is enough
 
personally I would do .asLines
 
@pmbanka don't include it. I highly doubt anyone would complain about you not incnluding it
 
@Downgoat I don't see any reason to have that separate from "\n".join(list)
 
10:07 PM
I should add change log to cheddar
 
I was actually thinking implementing the J command would be a fun challenge.
 
^ i agree
brb adding J command to cheddar
 
The one thing I'm not sure about is whether I should allow vim. I don't want to trivialize it, but I don't want to exclude my favorite language
 
@DJMcMayhem ban built-ins for the exact behavior?
 
CMC: convert:
0176899 optimize [loop]: Loops are now converted to `for`s
e0307cc optimize [TCO]: Performed internal tail-call optimization
284058b fix [noop]: Removed buggy noop op (`+`).
e05819f git [vbump]: Adjusted vbump script for verification
(and similar logs) into fancier representation
 
10:13 PM
@SEJPM Yeah, probably. Or just ban that one command
Actually, vim has four join commands
 
When faced with similar problems in the past when posting questions I generally figured "I don't care, so let there be one language where the problem is trivial but the fun about this is the myriad of solutions in languages where it's not trivial"
(at least) three of my 6 questions had answers with built-ins that made the problem trivial
 
If I take that approach, I'm gonna have to FGITW the trivial solution my self for fun. :)
The answer is just D@" in vim
 
I will also FGITW a downvote on such a solution ;P
oh
wait are we still talking aobut J chllenge?
 
@DJMcMayhem ... after all you can (and are encouraged) to answer your own Q at posting time :P
 
@Downgoat I have no clue what you mean
I meant this:
9 mins ago, by DJMcMayhem
I was actually thinking implementing the J command would be a fun challenge.
 
10:17 PM
sorry fixedf
>_> I am writing Python thing for cheddar, should i use python 2 or 3
python 3 is better but everyone use python2
 
BTW: If I have a challenge with a "complex" list-input format, are two or three test vectors enough or how many do people in here generally need?
 
> "aobut"... "chllenge"... "Fixed"...
 
@Downgoat use py3
 
@Downgoat Always 3 if possible
 
@Downgoat that was true 3-4 years ago. Don't worry about it, take the better one
V still uses py2... >_>
 
10:19 PM
ok. also, i need to run git command should i just do call(["git", "whatever"]) or should i do something better
 
@Downgoat \me *adds my voice to the chorus of "Python 3"*
 
I should probably fix that
 
@Downgoat Using the subprocess library? That's pretty much how you should do it.
 
I found git module i want to use
can i embed it in my repo?
kinda like how package.json stores all dependencies and installs them then
 
I haven't used such a tool for Python.
I've had to download dependencies myself pretty often, but then again, I don't use a Python IDE other than IDLE.
 
10:31 PM
@Downgoat use pip and lookup requirements.txt
 
D: python dont have struct?
 
i basically have this question:
216
Q: C-like structures in Python

wescIs there a way to conveniently define a C-like structure in Python? I'm tired of writing stuff like: class MyStruct(): def __init__(self, field1, field2, field3): self.field1 = field1 self.field2 = field2 self.field3 = field3

 
why do you want it?
like for packing?
 
You could just use a class or a dict
 
10:36 PM
2
A: Python ctypes definition for c struct

Roland SmithJust create a pointer, assign the data afterwards; import ctypes class EmxArray(ctypes.Structure): """ creates a struct to match emxArray_real_T """ _fields_ = [('data', ctypes.POINTER(ctypes.c_double)), ('size', ctypes.POINTER(ctypes.c_int)), ('allocate...

I don't think you know what you want though
 
i want to store data together. basically a "commit" object which has author, change and email field
class is cumbersome and overkill
 
@Downgoat use a dict?
 
dict is not best solution for given problem
dict is for like hashmap
i have fixed amount of elements and all
 
use dict
or a namedtuple
 
namedtuple looks correct but ill have to google
 
10:39 PM
I was going to say namedtuple yeah
 
206
A: C-like structures in Python

gz.Use a named tuple, which was added to the collections module in the standard library in Python 2.6. It's also possible to use Raymond Hettinger's named tuple recipe if you need to support Python 2.4. It's nice for your basic example, but also covers a bunch of edge cases you might run into later...

literally an answer to the question you linked?
 
ik i already did
 
> change [stdlib]: renamed vfuse to asLines
:/
 
CMC: Write shortest function to "chunk" array in to subarrays of length n in python ( you can assume the length of input array is multiple of n)
 
@Downgoat CMC?
 
10:43 PM
btw @Downgoat speed increaed by tenfold with babel-plugin-loop-optimizer is not so true
 
chat mini-challenge
 
@SEJPM Cheap Mega Chips
 
@TuxCopter that because oyur tests are borked
 
@TuxCopter don't get me hungry again :P
 
:33894686
     def chunk(self, inp:Node.indexable, size:Node.number):
        """Return inp seperated into groups sized size"""
        size = float(size)
        rtn = []
        last = 0
        for i, val in enumerate(inp):
            cur = i%size
            if cur <= last:
                if len(rtn):
                    if isinstance(inp, str):
                        rtn[-1] = "".join(rtn[-1])
                    else:
                        rtn[-1] = type(inp)(rtn[-1])
                rtn.append([])
 
10:44 PM
My tests only showed a 4x speedup
 
@Downgoat Is the input array size a multiple of n?
 
It's already big but tenfold is too much
 
@Sp3000 yes
 
list(zip(*[iter(L)]*n))
 
^ big golf
 
10:45 PM
(optional map(list,...) if you need them as lists rather than tuples)
 
thank you 10/10
i want named tuple but ok
 
In that case, list(map(MyNamedTuple,*[iter(L)]*n))
Assuming MyNamedTuple has n fields
 
okay another question: what is best way to loop in pairs of two?
e.g.loop but skip every other element
 
l[::2] if I understand correctly
 
^ i.e. for i in L[::2].
 
10:51 PM
"pairs of two" and "skip every other element" seems a bit contradictory to me, I'm a bit confused
 
@TuxCopter but then how to get item after current item (does that make sense)
wait i got this. I can use iter() magic
 
zip(l[::2], l[1::2])
[1, 2, 3, 4] => [[1, 2], [3, 4]]
 
@Downgoat Oh, you want for i,j in L where L is set up like [[a,b], [c,d], ...].
 
that don't seem very effuient though
@El'endiaStarman I want that but L is setup as [a,b,c,d,e,f]
 
@Downgoat it does it lazily?
 
10:52 PM
@Downgoat Then you can use Tux's code to change it.
Alternatively, do for i in range(len(L)//2): and then use L[2*i] and L[2*i+1].
 
@BlueEyedBeast so it will be fast running on > 1000 len array?
 
brb running test
 
@Downgoat it will work out each thing as it needs it
 
Alternatively you can go for i in range(0, len(L), 2): then access L[i] and L[i+1]
 
At least I think they changed it so splicing was an iterator
 
10:53 PM
@Downgoat Way too fast
 
actually. is it possible to do: [a,b,c,d] -> [[a,b], [b,c], [c,d]]?
 
It's a thing in itertools IIRC
 
ok
 
itertools has something like that? o_O
 
10:55 PM
@BlueEyedBeast: Actually, that's pretty much what the code in my previous message did. I fixed it. :P
 
Never underestimate itertools
 
def get_next(iter, last=""):
    next = chain(islice(iter, 1, None), [last])
    return zip(iter, next)
 
@Downgoat zip(L[:-1], L[1:])
 
with from itertools import chain, islice
 
(Apologies for the multiple pings.)
 
10:56 PM
for i in range(len(tags[:-1])):
    a, b = tags[i], tags[i + 1]
I just did that >_>
 
Yeah, that works perfectly well too.
 
Er... len(tags)-1 instead of len(tags[:-1])
 
another question: what is most reccomended way to string format?
I heard % is not good practice?
 
10:58 PM
Format strings. :P
 
% is the good ol' way, now there is format and ^ (Only in 3.6 though)
 
"{}".format()
and f-strings
 
@TuxCopter I'm fairly sure format strings are older than 3.6?
 

« first day (2135 days earlier)      last day (2694 days later) »