Live data from Hacker News

Show HN: SharePad.io – A collaborative code editor and compiler

sharepad.io

21–30 of 31 posts

Re: Show HN: SharePad.io – A collaborative code editor and compiler

#21

How are you handling timeouts and forks? The following to snippets have different results: #include int main() { while(1){ fork(); } return 1; } #include int main() { while(1){ } return 1; } The second snippet times out properly, but the first does not.

I have running time limit on the containers.

The first snippet is a fork bomb and will cause the container to run out of memory before the timeout. It does terminate since I have set a 256M memory limit. However, it is not sending the correct response in this case and the message in the output tab is not updated properly.

Fork works just fine, https://sharepad.io/p/aBn5Oxu

Re: Show HN: SharePad.io – A collaborative code editor and compiler

#22
post #18

Some starter code for each language that prints hello world would be nice. ALso, you can look to coderpad.io for other features to add for fun.

Yes, thanks for the feedback!

I am aware of coderpad.io, I think it is used mainly for remote interview targeting the enterprise market, not sure, will check it out further.

Re: Show HN: SharePad.io – A collaborative code editor and compiler

#23
post #2

Happy New Year! This is my first web dev side project and it's in early stage. As an interviewer in the tech industry, I often find myself cannot spot that subtle bug in candidates' code during phone screening, so I build this website which lets me do collaborative editing and also run the code. You may find it useful too. Please help try it out and provide some feedback. No registration is required (because I have y…

An engineer on my team years ago felt the same as you and built his own solution for us to use during interview, eventually spinning it into a very successful business. Check out coderpad.io if you wanna get some inspiration. They took a similar technical approach as you described, at least for the first versions.

Re: Show HN: SharePad.io – A collaborative code editor and compiler

#24
post #2

Happy New Year! This is my first web dev side project and it's in early stage. As an interviewer in the tech industry, I often find myself cannot spot that subtle bug in candidates' code during phone screening, so I build this website which lets me do collaborative editing and also run the code. You may find it useful too. Please help try it out and provide some feedback. No registration is required (because I have y…

An engineer on my team years ago felt the same as you and built his own solution for us to use during interview, eventually spinning it into a very successful business. Check out coderpad.io if you wanna get some inspiration. They took a similar technical approach as you described, at least for the first versions.

Thanks, this is really inspiring!

Re: Show HN: SharePad.io – A collaborative code editor and compiler

#25
post #15

Pretty cool side project. Are you using Judge0 for code execution?

No, the code is executed in docker containers hosted on Azure VM.

Apologies for doing this "in public," but the About page has no contact info, nor does your HN profile

You will want to /dev/null the IMDS (https://docs.microsoft.com/en-us/azure/virtual-machines/linu... ); your setup didn't appear immediately exploitable, but I am also not an experienced Azure escape artist: https://sharepad.io/p/whno49w

Re: Show HN: SharePad.io – A collaborative code editor and compiler

#26
post #25
post #15

Earlier quoted context omitted.

No, the code is executed in docker containers hosted on Azure VM.

Apologies for doing this "in public," but the About page has no contact info, nor does your HN profile You will want to /dev/null the IMDS ( https://docs.microsoft.com/en-us/azure/virtual-machines/linu... ); your setup didn't appear immediately exploitable, but I am also not an experienced Azure escape artist: https://sharepad.io/p/whno49w

Thanks for the security reminder, I have blocked IMDS access, need to learn more about security. I'll also set up email so that I can put in the about page.

Re: Show HN: SharePad.io – A collaborative code editor and compiler

#28
The service can call itself, forever

    import urllib.request
    import json
    import threading

    def do_request():
        data = {"lang":"python", "code": open(__file__).read(), "stdin": ""}
        req = urllib.request.Request(
            "https://www.sharepad.io/run", 
            data=json.dumps(data).encode('utf-8'), 
            headers={
                'Content-Type': 'application/json'
            }
        )

        f = urllib.request.urlopen(req)
        print(f.read().decode('utf-8'))
    x = threading.Thread(target=do_request)
    x.start()
    do_request()
    x.join()

Re: Show HN: SharePad.io – A collaborative code editor and compiler

#29
post #28

The service can call itself, forever import urllib.request import json import threading def do_request(): data = {"lang":"python", "code": open(__file__).read(), "stdin": ""} req = urllib.request.Request( "https://www.sharepad.io/run", data=json.dumps(data).encode('utf-8'), headers={ 'Content-Type': 'application/json' } ) f = urllib.request.urlopen(req) print(f.read().decode('utf-8')) x = threading.Thread(target=do_r…

Oh, I was not aware of this, definitely need to fix this, thanks!

Re: Show HN: SharePad.io – A collaborative code editor and compiler

#30
post #21

How are you handling timeouts and forks? The following to snippets have different results: #include int main() { while(1){ fork(); } return 1; } #include int main() { while(1){ } return 1; } The second snippet times out properly, but the first does not.

I have running time limit on the containers. The first snippet is a fork bomb and will cause the container to run out of memory before the timeout. It does terminate since I have set a 256M memory limit. However, it is not sending the correct response in this case and the message in the output tab is not updated properly. Fork works just fine, https://sharepad.io/p/aBn5Oxu

Nice, i was wandering why the fork bomb didn't give a time out message, but that makes sense.

Are you using websockets to broadcast realtime updates to the clients, as one types, or do you have some other way to achieve that?

Post reply on HN