Giter VIP home page Giter VIP logo

hn-delete-negative-point-comments's Introduction

What it does

Deletes your HN comments automatically that have negative points

WHY do this

Ever post a comment you regret? Often these comments have negative points. If you aren't monitoring the comment closely you will lose your ability to delete the comment -- making it permanent :(

Install dependencies:

bundle install 

How to run it

To use:

ruby run.rb [YOURUSERNAME] [YOURPASSWORD] [MIN_NUMBER_OF_POINTS]

let's delete comments less than one point

ruby run.rb USERNAME PASSWORD 1 

let's delete comments less than two points

ruby run.rb USERNAME PASSWORD 2

How to get it to run automatically?

add rvm properties to your cronjob file [backup your crontab first!]

rvm cron setup; 

open crontab in your Terminal:

crontab -e

Add this line:

* * * * * cd [path to code source]; ruby run.rb [YOURUSERNAME] [YOURPASSWORD] [MIN_NUMBER_OF_POINTS]

Example

cd /Users/username/hn-delete-negative-point-comments; ruby run.rb throwaway203821 throwawaypassword 1  >> /tmp/delete.log

On macOS to get the ruby path, type in your Terminal:

which ruby 

On macOS if you have problems with crontab with "Operation not permitted"

http://osxdaily.com/2018/10/09/fix-operation-not-permitted-terminal-error-macos/

For more help with crontab

https://ole.michelsen.dk/blog/schedule-jobs-with-crontab-on-mac-osx.html

For more help with rvm and cron

https://stackoverflow.com/questions/5680561/need-to-set-up-rvm-environment-prior-to-every-cron-job

Watch it run (Assuming you pipe it to /tmp/delete.log)

$ tail -f /tmp/delete.log
No bad comments....
No bad comments....
No bad comments....
No bad comments....
Deleting comment: 18588594
No bad comments....

Tests

ruby test.rb 

hn-delete-negative-point-comments's People

Contributors

james-ransom avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

intfrr

hn-delete-negative-point-comments's Issues

cannot load such file

$ ruby -v
ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux]

$ gem -v
3.0.1

and I'm getting the following:

$ ruby test.rb 
Traceback (most recent call last):
        4: from test.rb:2:in `<main>'
        3: from test.rb:2:in `load'
        2: from watch.rb:1:in `<top (required)>'
        1: from /usr/local/lib/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/usr/local/lib/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- rest-client (LoadError)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.