Skip to content

Instantly share code, notes, and snippets.

@miketartar
Created September 26, 2020 04:21
Show Gist options
  • Save miketartar/0fc8d7bca2369ce73ea9ee7b6e0c3775 to your computer and use it in GitHub Desktop.
Save miketartar/0fc8d7bca2369ce73ea9ee7b6e0c3775 to your computer and use it in GitHub Desktop.
Cold Turkey Blocker Activator
import json
import sqlite3
import os
DB_PATH = "C:/ProgramData/Cold Turkey/data-app.db"
def activate():
try:
conn = sqlite3.connect(DB_PATH)
c = conn.cursor()
s = c.execute("SELECT value FROM settings WHERE key = 'settings'").fetchone()[0]
dat = json.loads(s)
if dat["additional"]["proStatus"] != "pro":
print("Your version of Cold Turkey Blocker is not activated.")
dat["additional"]["proStatus"] = "pro"
print("But now it is activated.\nPlease close Cold Turkey Blocker and run again it.")
c.execute("""UPDATE settings SET value = ? WHERE "key" = 'settings'""", (json.dumps(dat),))
conn.commit()
else:
print("Looks like your copy of Cold Turkey Blocker is already activated.")
print("Deactivating it now.")
dat["additional"]["proStatus"] = "free"
c.execute("""UPDATE settings set value = ? WHERE "key" = 'settings'""", (json.dumps(dat),))
conn.commit()
except sqlite3.Error as e:
print("Failed to activate", e)
finally:
if conn:
conn.close()
def main():
if os.path.exists(DB_PATH):
print("Data file found.\nLet's activate your copy of Cold Turkey Blocker.")
activate()
else:
print("Looks like Cold Turkey Blocker is not installed.\n If it is installed then run it at least once.")
if __name__ == '__main__':
main()
@MaikMaster5
Copy link

Already tried deleting the db file itself?

@xtiigma
Copy link

xtiigma commented Jun 18, 2025

Already tried deleting the db file itself?

Of course, with the uninstaller delete the entire folder

@Ghost-07a
Copy link

Ghost-07a commented Jun 22, 2025

@SmartN0OB
Copy link

Hi everyone,

I was previously using Cold Turkey Blocker version 4.7. I completely uninstalled it using BCUninstaller, then tried installing versions 4.5 and 4.6. However, I'm still getting the same error every time I launch the app:

Error Reading Database
The database where your settings are stored is locked and can't be read. Try opening Cold Turkey Blocker in a few seconds.

I’ve already checked the task manager and made sure no background processes are running. Has anyone experienced this issue? Any ideas on how to fix it?

Thanks in advance!

version 4.7 works fine but for 4.5 I'm getting the same error still haven't figured out how to solve it

@dangopea
Copy link

Latest mac version? Anyone?
Ran into this problem, please help out

Screenshot 2568-06-25 at 9 40 06 PM

The mac version is below.

How to use:

  1. Go to Allow in Background and turn off Felix Belzile.
  2. Press option+command+esc to quit Cold Turkey Blocker.
  3. Open TextEdit and create a new file named ColdTurkeyBlockerActivator.py (save it as .txt first, then rename it to .py).
  4. Paste cd ~/Documents in Terminal and press Enter.
  5. Run the script with sudo python3 ColdTurkeyBlockerActivator.py and enter your password when prompted.
  6. Enjoy your activated Cold Turkey Blocker!
import json
import sqlite3
import os

DB_PATH = "/Library/Application Support/Cold Turkey/data-app.db"

def activate():
    try:
        conn = sqlite3.connect(DB_PATH)
        c = conn.cursor()
        s = c.execute("SELECT value FROM settings WHERE key = 'settings'").fetchone()[0]
        dat = json.loads(s)

        if dat["additional"]["proStatus"] != "pro":
            print("Your version of Cold Turkey Blocker is not activated.")
            dat["additional"]["proStatus"] = "pro"
            print("But now it is activated.\nPlease close Cold Turkey Blocker and run again it.")
            c.execute("""UPDATE settings SET value = ? WHERE "key" = 'settings'""", (json.dumps(dat),))
            conn.commit()
        else:
            print("Looks like your copy of Cold Turkey Blocker is already activated.")
            print("Deactivating it now.")
            dat["additional"]["proStatus"] = "free"
            c.execute("""UPDATE settings SET value = ? WHERE "key" = 'settings'""", (json.dumps(dat),))
            conn.commit()

    except sqlite3.Error as e:
        print("Failed to activate", e)
    finally:
        if conn:
            conn.close()

def main():
    if os.path.exists(DB_PATH):
        print("Data file found.\nLet's activate your copy of Cold Turkey Blocker.")
        activate()
    else:
        print("Looks like Cold Turkey Blocker is not installed.\nIf it is installed then run it at least once.")

if __name__ == '__main__':
    main()

@Scotax
Copy link

Scotax commented Jun 27, 2025

Can Anyboady tell me How to do this like a detailed guide. I have cold turkey 4.5
First where to put the code and where to make the folder is it in cold turkey or in 'c' folder
second do i need to python to be installed in my pc
Third If anybody can make a video or write it briefly it will be helpful.

@Scotax
Copy link

Scotax commented Jun 27, 2025

image
Bro it showed this. And is the file location right or wrong please help.

@Scotax
Copy link

Scotax commented Jun 27, 2025

I ran it and the app is still on the free version.

Run the code of SobhnathxLuffy. Its worked for me

bro its not working for 4.6 any tips you can provide?

I'm on 4.6 version and this worked for me. Try the code JustaTurtle21 just updated above, https://gist.github.com/miketartar/0fc8d7bca2369ce73ea9ee7b6e0c3775?permalink_comment_id=5426749#gistcomment-5426749. Just download python, set up the environment, create a file name.txt, and open CMD, type "python name.txt" and it should be worked. Screenshot 2025-04-15 182327

What is the emaning of setting up environment? I don't know

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