Live data from Hacker News

Ask HN: How would you improve this bash oneliner for deleting tweets?

news.ycombinator.com

11–20 of 27 posts

Re: Ask HN: How would you improve this bash oneliner for deleting tweets?

#11

You might consider putting this in a GitHub Gist, sharing the link for it, and accept comments and improvements within the Gist comments functionality. This would also allow others to fork your code to improve upon or keep a copy for themselves.

(Security risks aside,)

That can even allow people to curl and pipe to run in the terminal direct from github.

Re: Ask HN: How would you improve this bash oneliner for deleting tweets?

#12

You might consider putting this in a GitHub Gist, sharing the link for it, and accept comments and improvements within the Gist comments functionality. This would also allow others to fork your code to improve upon or keep a copy for themselves.

(Security risks aside,) That can even allow people to curl and pipe to run in the terminal direct from github.

[deleted]

Re: Ask HN: How would you improve this bash oneliner for deleting tweets?

#17

You could improve it by making it not a one-liner! Usually making it a multiple-liner can improve readability. And unless you're typing it into the command line directly everytime you run it (as opposed to putting it in a file that you invoke) it doesn't really matter how many lines it has.

I came here to say this. In addition, searching through bash history is a terrible "save and fetch" interface

Re: Ask HN: How would you improve this bash oneliner for deleting tweets?

#18
post #15

I've tried this before in a Python script but quickly got rate limited by the 300 tweet update limit [0]. Does this get around that? [0] https://developer.twitter.com/en/docs/basics/rate-limits

It's hard to imagine that it would

Re: Ask HN: How would you improve this bash oneliner for deleting tweets?

#19

You could improve it by making it not a one-liner! Usually making it a multiple-liner can improve readability. And unless you're typing it into the command line directly everytime you run it (as opposed to putting it in a file that you invoke) it doesn't really matter how many lines it has.

It's not just readability.

One day the code breaks. For a one liner I have to pick it apart, add logging / diagnostics, fix it, and reassemble. The two most time consuming and error prone parts of that are dealing with the 'one liner'

Re: Ask HN: How would you improve this bash oneliner for deleting tweets?

#20
What are the rate limits on the /statuses/destroy endpoint? I've checked the docs and the docs say it is limited but the actual limit is not specified.

Other than that, thanks for writing this! I've been thinking about a tool like this and this might come in handy. The code looks fine to me although I would probably spin this out into a script and add some logging, as others have already pointed out.

Post reply on HN