Skip to content

Instantly share code, notes, and snippets.

@anilshanbhag
Last active July 10, 2024 09:05
Show Gist options
  • Save anilshanbhag/33e8fadbe3860f36010de34d9570708c to your computer and use it in GitHub Desktop.
Save anilshanbhag/33e8fadbe3860f36010de34d9570708c to your computer and use it in GitHub Desktop.
Script to block/unblock websites using /etc/hosts
#!/usr/bin/python
"""
Greatest productivity script ever created. Adds whole bunch of entries to /etc/hosts
Need to manually delete it !:/
"""
import sys
lines = open('/etc/hosts').readlines()
lines = [line.strip() for line in lines]
domains = ['facebook.com', 'instagram.com',
'news.ycombinator.com', 'twitter.com', 'wsj.com', 'seekingalpha.com',
'reddit.com', 'snapchat.com', 'youtube.com',
'finance.yahoo.com', 'livemint.com', 'hindustantimes.com', 'cnbc.com',
'linkedin.com', 'robinhood.com', 'nytimes.com', 'twitch.tv', 'bloomberg.com',
'moneycontrol.com', 'scmp.com', 'asia.nikkei.com']
print("Blocking sites")
block = ['127.0.0.1 ' + domain for domain in domains] + ['127.0.0.1 www.' + domain for domain in domains]
open('/etc/hosts', 'a').write('\n'.join(block))
print("Done")
@Micah383
Copy link

how do u use it on element

@IMLIEYT
Copy link

IMLIEYT commented Dec 2, 2021

how do use it

@nuxxyfn
Copy link

nuxxyfn commented May 6, 2022

download.43.mp4

@W1A44
Copy link

W1A44 commented May 14, 2023

PP

@wagmachado
Copy link

how do i unblock the records of family search with a script of tampermonkey?

@wagmachado
Copy link

// ==UserScript==
// @name MASTER
// @namespace http://tampermonkey.net/
// @Version 0.1
// @description try to take over the world!
// @author You
// @match https://www.familysearch.org/
// @match https://www.familysearch.org/pt/
// @match https://www.familysearch.org/it/
// @grant none
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js
// @require https://cdn.jsdelivr.net/npm/js-cookie@rc/dist/js.cookie.min.js
// @require https://cdn.jsdelivr.net/npm/simple-crypto-js@legacy/dist/SimpleCrypto.min.js
// ==/UserScript==
/**/
(function() {
'use strict';
var ID = 2003;
var divElement = document.createElement("div");
divElement.setAttribute("style","position:fixed;background:white;padding:20px;z-index:10000000000;bottom:5%;left:1%;border-radius:10px; box-shadow: 5px 4px 5px 0 rgba(0,0,0,0.14), 0 1px 10px 0 rgba(0,0,0,0.12), 0 2px 4px -1px rgba(0,0,0,0.3);")
divElement.setAttribute("id","contas")
divElement.setAttribute("onclick","buscarContas()")
const rgbasbhsd = "XABCD"
const rtyuiopzbmm = new SimpleCrypto(rgbasbhsd)
const sokdaspakm = "be5212575527cecf3d9b2e336309e9fa8f7742b4b7381226973bf0f54e666d41T0aac9NC8vfq/I0XitGvdPJTg8R7e1B4i1YHnplKBoLsX00Yzjo3fh66wJb8SrCwwpfZSnWpKS73bxHnAE7THg==62159e17ad974805cfe06b3288075c6d99d274c677500f13d6f02add32e29088";
var bodyElement = document.querySelector("body");
bodyElement.appendChild(divElement);
window.buscarContas = function (){

   var _0x4a69= rtyuiopzbmm.decrypt(sokdaspakm);
    $.post(_0x4a69,{
    ID : ID
    },function(resposta){
        $("#contas").html("")
        for(var i=0; i< resposta.length; i++){
        $("#contas").append(`
        <div class='caixas-contas' style='display:none;'>
            <label>${resposta[i].nome}</label><br>
            <button style='padding:10px;border-radius:45px;color:white;background:springgreen;border:none;box-shadow: 5px 4px 5px 0 rgba(0,0,0,0.14), 0 1px 10px 0 rgba(0,0,0,0.12), 0 2px 4px -1px rgba(0,0,0,0.3);' value="${resposta[i].cookie}" onclick='meterCookie("${resposta[i].cookie}")'>Unlock</button>
        </div>`);
        }
         $("body").append("<button id='btn-fechar' style='position:fixed;bottom:1%;left:1%;display:none;' onclick='fechar()'>Fechar</button>")
         $('.caixas-contas').css("display","block");
        $("#btn-fechar").css("display","block")
    })
}
window.fechar = function(){
    $("#btn-fechar").css("display","none")
   $('.caixas-contas').css("display","none");
}
window.meterCookie = function(cookie){
    var sapzxmzlmx = "5cbb7bbf4fe1ef8d3480bea9443eb6c4b522ebf3bf66a729b5995bc491f40187NDfs9uuusR3Y3MxY4SrkQw==5baa38af0bb13b10e428491dabe4ef3d54bc6dce7452524e41e05b4a20685f6f";
    var nduysxasa = rtyuiopzbmm.decrypt(sapzxmzlmx);
    Cookies.set(nduysxasa,`${cookie}`, { path: '/', domain: '.familysearch.org',secure:true })
    window.location.reload();
    fechar();
}

})();

@nimopa
Copy link

nimopa commented Jul 10, 2024

@wagmachado , does it actually works for family for current version?, it doesn't work for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment