Skip to content

Instantly share code, notes, and snippets.

@ivmirx
Last active May 7, 2025 23:17
Show Gist options
  • Select an option

  • Save ivmirx/66a0015884d44297ea05a8c54d93566d to your computer and use it in GitHub Desktop.

Select an option

Save ivmirx/66a0015884d44297ea05a8c54d93566d to your computer and use it in GitHub Desktop.

Revisions

  1. ivmirx revised this gist May 7, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion filter.js
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ var words = [
    'gpl', 'drm', 'court', 'legal', 'tiktok',
    'francisco', 'new york', 'california', 'bay area', 'texas', 'florida', 'wall street', 'el salvador', 'canad', 'austral',
    'billionaire', 'musk', 'bezos', 'bill gates', 'zuckerberg', 'trump', 'rfk', 'j.d.', 'waltz', 'doge '
    'politics', 'u.s.', 'white house', 'federal', 'president', 'congress', 'senate', 'scotus', 'court', 'police', 'military', 'fbi', 'cia', 'nsa', 'immigration', 'democracy', 'election', 'mayor', 'liberal', 'republican', 'democrat',
    'politics', 'u.s.', 'white house', 'federal', 'president', 'congress', 'senate', 'scotus', 'court', 'police', 'military', 'fbi', 'cia ', 'nsa', 'immigration', 'democracy', 'election', 'mayor', 'liberal', 'republican', 'democrat',
    'nato', 'russia', 'ukrain', 'china', 'chinese', 'norw', 'german', 'gaza', 'palestin', 'israel', 'idf', 'nazi', 'terrorist',
    'guardian', 'vox', 'forbes', 'bbc', 'cnn', 'fox news', 'new york times', 'nyt', 'reuters'];

  2. ivmirx revised this gist May 3, 2025. 1 changed file with 8 additions and 8 deletions.
    16 changes: 8 additions & 8 deletions filter.js
    Original file line number Diff line number Diff line change
    @@ -1,16 +1,16 @@
    var words = [
    'php', 'js', 'css', 'html', 'java', 'ruby', 'rust', 'golang', 'kotlin', 'perl',
    'elixir', 'elm ', 'erlang', 'clojure', 'lisp', 'racket', 'scala', 'haskell'
    'mozilla', 'firefox', 'sql', 'mongo', 'latex', 'webgl', 'kagi',
    'php', 'js', 'css', 'html', 'webgl', 'java', 'ruby', 'golang', 'kotlin', 'perl', 'zig', 'gcc', 'c++',
    'elixir', 'elm ', 'erlang', 'clojure', 'lisp', 'racket', 'scala', 'haskell',
    'mozilla', 'firefox', 'wordpress', 'kagi ', 'sql', 'mongo', 'latex',
    'kubernetes', 'docker', 'tensor', 'graphql', ' ml ', 'machine learning',
    'google', 'facebook', 'amazon', 'aws ', 'dell', 'amd', 'verizon', 'airbnb', 'uber', 'tesla', 'spacex', 'self-driving',
    'alphabet', 'facebook', 'amazon', 'aws ', 'dell', 'amd', 'verizon', 'airbnb', 'uber', 'tesla', 'spacex', 'self-driving', 'waymo',
    'fundraising', 'investor', 'venture', 'unicorn',
    'bitcoin', 'btc', 'ethereum', 'blockchain', 'cryptocurrenc',
    'gpl', 'drm', 'court', 'legal',
    'bitcoin', 'btc', 'ethereum', 'blockchain', 'cryptocurrenc', 'nft',
    'gpl', 'drm', 'court', 'legal', 'tiktok',
    'francisco', 'new york', 'california', 'bay area', 'texas', 'florida', 'wall street', 'el salvador', 'canad', 'austral',
    'billionaire', 'musk', 'bezos', 'bill gates', 'zuckerberg', 'trump', 'rfk', 'j.d.',
    'billionaire', 'musk', 'bezos', 'bill gates', 'zuckerberg', 'trump', 'rfk', 'j.d.', 'waltz', 'doge '
    'politics', 'u.s.', 'white house', 'federal', 'president', 'congress', 'senate', 'scotus', 'court', 'police', 'military', 'fbi', 'cia', 'nsa', 'immigration', 'democracy', 'election', 'mayor', 'liberal', 'republican', 'democrat',
    'nato', 'russia', 'ukrain', 'china', 'chinese', 'gaza', 'palestin', 'israel', 'idf', 'nazi', 'terrorist',
    'nato', 'russia', 'ukrain', 'china', 'chinese', 'norw', 'german', 'gaza', 'palestin', 'israel', 'idf', 'nazi', 'terrorist',
    'guardian', 'vox', 'forbes', 'bbc', 'cnn', 'fox news', 'new york times', 'nyt', 'reuters'];

    function filter(list) {
  3. ivmirx revised this gist Apr 30, 2025. 1 changed file with 8 additions and 6 deletions.
    14 changes: 8 additions & 6 deletions filter.js
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,15 @@
    var words = [
    'php', 'js', 'css', 'html', 'java', 'ruby', 'rust', 'golang', 'kotlin', 'perl',
    'elixir', 'elm ', 'erlang', 'clojure', 'lisp', 'racket', 'scala',
    'mozilla', 'firefox', 'mysql', 'mongo', 'latex', 'webgl',
    'kubernetes', 'docker', 'tensor', 'graphql', ' ml ', 'machine learning', 'artificial intelligence', 'ai ',
    'elixir', 'elm ', 'erlang', 'clojure', 'lisp', 'racket', 'scala', 'haskell'
    'mozilla', 'firefox', 'sql', 'mongo', 'latex', 'webgl', 'kagi',
    'kubernetes', 'docker', 'tensor', 'graphql', ' ml ', 'machine learning',
    'google', 'facebook', 'amazon', 'aws ', 'dell', 'amd', 'verizon', 'airbnb', 'uber', 'tesla', 'spacex', 'self-driving',
    'fundraising', 'investor', 'venture', 'unicorn', 'billionaire', 'musk', 'bezos', 'bill gates',
    'fundraising', 'investor', 'venture', 'unicorn',
    'bitcoin', 'btc', 'ethereum', 'blockchain', 'cryptocurrenc',
    'francisco', 'new york', 'california', 'bay area', 'texas', 'florida', 'wall street',
    'politics', 'u.s.', 'white house', 'federal', 'president', 'congress', 'senate', 'scotus', 'court', 'police', 'military', 'fbi', 'cia', 'nsa', 'immigration', 'democracy', 'election', 'mayor', 'trump', 'biden',
    'gpl', 'drm', 'court', 'legal',
    'francisco', 'new york', 'california', 'bay area', 'texas', 'florida', 'wall street', 'el salvador', 'canad', 'austral',
    'billionaire', 'musk', 'bezos', 'bill gates', 'zuckerberg', 'trump', 'rfk', 'j.d.',
    'politics', 'u.s.', 'white house', 'federal', 'president', 'congress', 'senate', 'scotus', 'court', 'police', 'military', 'fbi', 'cia', 'nsa', 'immigration', 'democracy', 'election', 'mayor', 'liberal', 'republican', 'democrat',
    'nato', 'russia', 'ukrain', 'china', 'chinese', 'gaza', 'palestin', 'israel', 'idf', 'nazi', 'terrorist',
    'guardian', 'vox', 'forbes', 'bbc', 'cnn', 'fox news', 'new york times', 'nyt', 'reuters'];

  4. ivmirx revised this gist Jun 16, 2024. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions manifest.json
    Original file line number Diff line number Diff line change
    @@ -7,11 +7,11 @@
    "tabs"
    ],
    "host_permissions": [
    "http://hckrnews.com/"
    "https://hckrnews.com/"
    ],
    "content_scripts": [
    {
    "matches": ["http://hckrnews.com/"],
    "matches": ["https://hckrnews.com/"],
    "js": ["filter.js"]
    }
    ]
  5. ivmirx revised this gist Jun 16, 2024. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions manifest.json
    Original file line number Diff line number Diff line change
    @@ -1,18 +1,18 @@
    {
    "manifest_version": 2,
    "manifest_version": 3,
    "name": "hckrnews.com filter",
    "version": "1.0",

    "description": "Filter out submissions on hckrnews.com based on keywords",

    "permissions": [
    "tabs"
    ],

    "host_permissions": [
    "http://hckrnews.com/"
    ],
    "content_scripts": [
    {
    "matches": ["http://hckrnews.com/"],
    "js": ["filter.js"]
    }
    ]
    }
    }
  6. ivmirx revised this gist Jun 13, 2024. 1 changed file with 9 additions and 8 deletions.
    17 changes: 9 additions & 8 deletions filter.js
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,15 @@
    var words = [
    'php', 'js', 'javascript', 'css', 'java', 'ruby', 'rust', 'golang', 'go\'s', 'kotlin', 'perl',
    'php', 'js', 'css', 'html', 'java', 'ruby', 'rust', 'golang', 'kotlin', 'perl',
    'elixir', 'elm ', 'erlang', 'clojure', 'lisp', 'racket', 'scala',
    'mozilla', 'firefox', 'mysql', 'mongo', 'latex', 'webgl',
    'dell', 'amd',
    'google', 'facebook', 'amazon', 'aws ', 'airbnb', 'uber', 'unicorn', 'damore', 'kalanick', 'bezos',
    'kubernetes', 'docker', 'tensor', ' ml ', 'machine learning', 'artificial intelligence',
    'self-driving', 'tesla', 'musk', 'spacex', 'hyperloop', 'bitcoin', 'btc', 'ethereum', 'blockchain',
    'u.s.', 'president', 'trump', 'congress', 'police', 'military', 'federal', 'fbi', 'nsa ', 'snowden',
    'francisco', 'new york', 'california', 'bay area', 'texas', 'wall street', 'verizon',
    'guardian.com', 'vox.com', 'forbes.com'];
    'kubernetes', 'docker', 'tensor', 'graphql', ' ml ', 'machine learning', 'artificial intelligence', 'ai ',
    'google', 'facebook', 'amazon', 'aws ', 'dell', 'amd', 'verizon', 'airbnb', 'uber', 'tesla', 'spacex', 'self-driving',
    'fundraising', 'investor', 'venture', 'unicorn', 'billionaire', 'musk', 'bezos', 'bill gates',
    'bitcoin', 'btc', 'ethereum', 'blockchain', 'cryptocurrenc',
    'francisco', 'new york', 'california', 'bay area', 'texas', 'florida', 'wall street',
    'politics', 'u.s.', 'white house', 'federal', 'president', 'congress', 'senate', 'scotus', 'court', 'police', 'military', 'fbi', 'cia', 'nsa', 'immigration', 'democracy', 'election', 'mayor', 'trump', 'biden',
    'nato', 'russia', 'ukrain', 'china', 'chinese', 'gaza', 'palestin', 'israel', 'idf', 'nazi', 'terrorist',
    'guardian', 'vox', 'forbes', 'bbc', 'cnn', 'fox news', 'new york times', 'nyt', 'reuters'];

    function filter(list) {
    var entries = list.getElementsByClassName('entry row');
  7. ivmirx revised this gist Sep 11, 2017. 1 changed file with 17 additions and 4 deletions.
    21 changes: 17 additions & 4 deletions filter.js
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,13 @@
    var words = [
    'php', 'js', 'javascript', 'css', 'java', 'ruby', 'rust', 'golang', 'go\'s', 'kotlin', 'perl',
    'elixir', 'elm ', 'erlang', 'clojure', 'lisp', 'racket', 'scala',
    'mozilla', 'firefox', 'mysql', 'latex', 'webgl',
    'mozilla', 'firefox', 'mysql', 'mongo', 'latex', 'webgl',
    'dell', 'amd',
    'google', 'facebook', 'amazon', 'aws ', 'airbnb', 'uber', 'unicorn',
    'google', 'facebook', 'amazon', 'aws ', 'airbnb', 'uber', 'unicorn', 'damore', 'kalanick', 'bezos',
    'kubernetes', 'docker', 'tensor', ' ml ', 'machine learning', 'artificial intelligence',
    'self-driving', 'tesla', 'musk', 'spacex', 'hyperloop', 'bitcoin', 'btc', 'ethereum', 'blockchain',
    'u.s.', 'president', 'trump', 'congress', 'police', 'military', 'federal', 'fbi', 'nsa ', 'snowden',
    'francisco', 'new york', 'california', 'texas', 'wall street', 'verizon',
    'francisco', 'new york', 'california', 'bay area', 'texas', 'wall street', 'verizon',
    'guardian.com', 'vox.com', 'forbes.com'];

    function filter(list) {
    @@ -22,7 +22,7 @@ function filter(list) {
    var text = link.innerText.toLowerCase();
    for (var j = words.length - 1; j >= 0; j--) {
    if (text.indexOf(words[j]) != -1) {
    console.log(text);
    logEntry(entries[i], link);
    filteredEntries.push(entries[i]);
    break;
    }
    @@ -34,6 +34,19 @@ function filter(list) {
    }
    }

    function logEntry(entry, link) {
    var points = entry.getElementsByClassName('points')[0].innerText;
    if (points < 100) {
    return;
    }

    var commentsCount = entry.getElementsByClassName('comments')[0].innerText;
    console.log(commentsCount + '/' + points + ' ' + link.innerText);

    var commentsLink = entry.getElementsByClassName('hn span3 story ')[0].href;
    console.log(commentsLink);
    }

    var entryLists = document.getElementsByClassName('entries unstyled');
    for (var i = entryLists.length - 1; i >= 0; i--) {
    filter(entryLists[i]);
  8. ivmirx revised this gist Aug 7, 2017. 1 changed file with 9 additions and 6 deletions.
    15 changes: 9 additions & 6 deletions filter.js
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,13 @@
    var words = [
    'php', 'js', 'javascript', 'java', 'ruby', 'rust', 'golang', 'go\'s',
    'kubernetes', 'docker', 'tensor', ' ml ', 'machine learning',
    'google', 'facebook', 'amazon', 'airbnb', 'uber', 'unicorn',
    'self-driving', 'tesla', 'musk', 'spacex', 'bitcoin', 'btc', 'ethereum', 'blockchain',
    'u.s.', 'president', 'trump', 'congress', 'police', 'military', 'federal', 'fbi', 'nsa ',
    'francisco', 'new york', 'california', 'wall street',
    'php', 'js', 'javascript', 'css', 'java', 'ruby', 'rust', 'golang', 'go\'s', 'kotlin', 'perl',
    'elixir', 'elm ', 'erlang', 'clojure', 'lisp', 'racket', 'scala',
    'mozilla', 'firefox', 'mysql', 'latex', 'webgl',
    'dell', 'amd',
    'google', 'facebook', 'amazon', 'aws ', 'airbnb', 'uber', 'unicorn',
    'kubernetes', 'docker', 'tensor', ' ml ', 'machine learning', 'artificial intelligence',
    'self-driving', 'tesla', 'musk', 'spacex', 'hyperloop', 'bitcoin', 'btc', 'ethereum', 'blockchain',
    'u.s.', 'president', 'trump', 'congress', 'police', 'military', 'federal', 'fbi', 'nsa ', 'snowden',
    'francisco', 'new york', 'california', 'texas', 'wall street', 'verizon',
    'guardian.com', 'vox.com', 'forbes.com'];

    function filter(list) {
  9. ivmirx created this gist Jul 28, 2017.
    48 changes: 48 additions & 0 deletions filter.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,48 @@
    var words = [
    'php', 'js', 'javascript', 'java', 'ruby', 'rust', 'golang', 'go\'s',
    'kubernetes', 'docker', 'tensor', ' ml ', 'machine learning',
    'google', 'facebook', 'amazon', 'airbnb', 'uber', 'unicorn',
    'self-driving', 'tesla', 'musk', 'spacex', 'bitcoin', 'btc', 'ethereum', 'blockchain',
    'u.s.', 'president', 'trump', 'congress', 'police', 'military', 'federal', 'fbi', 'nsa ',
    'francisco', 'new york', 'california', 'wall street',
    'guardian.com', 'vox.com', 'forbes.com'];

    function filter(list) {
    var entries = list.getElementsByClassName('entry row');
    var filteredEntries = [];

    for (var i = entries.length - 1; i >= 0; i--) {
    var link = entries[i].getElementsByClassName('link span15 story')[0];
    if (link == null)
    continue;

    var text = link.innerText.toLowerCase();
    for (var j = words.length - 1; j >= 0; j--) {
    if (text.indexOf(words[j]) != -1) {
    console.log(text);
    filteredEntries.push(entries[i]);
    break;
    }
    }
    }

    for (var i = filteredEntries.length - 1; i >= 0; i--) {
    filteredEntries[i].parentNode.removeChild(filteredEntries[i]);
    }
    }

    var entryLists = document.getElementsByClassName('entries unstyled');
    for (var i = entryLists.length - 1; i >= 0; i--) {
    filter(entryLists[i]);
    }

    var observer = new MutationObserver(function(mutations) {
    mutations.forEach(function(item) {
    item.addedNodes.forEach(function(node) {
    filter(node);
    });
    });
    });

    var div = document.querySelector('#entries');
    observer.observe(div, { childList: true });
    18 changes: 18 additions & 0 deletions manifest.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    {
    "manifest_version": 2,
    "name": "hckrnews.com filter",
    "version": "1.0",

    "description": "Filter out submissions on hckrnews.com based on keywords",

    "permissions": [
    "tabs"
    ],

    "content_scripts": [
    {
    "matches": ["http://hckrnews.com/"],
    "js": ["filter.js"]
    }
    ]
    }