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()
@Labusen
Copy link

Labusen commented Dec 26, 2023

Beautiful, now i can focus on my studies, you are a life saver! THANK YOU !

@rick232006
Copy link

Beautiful, now i can focus on my studies, you are a life saver! THANK YOU !

can you please help me do it cause i am not that techy person

@rick232006
Copy link

thank you so much it works great also I would like to tell anyone that is reading this that don't update the cold turkey they rectify these loop holes and you have to wait for the crack everytime

bro can you help do this cause i am not that techy person

@vovavili
Copy link

vovavili commented Dec 30, 2023

Looks brilliant. Suprised to see they trust you enough to make activation a matter of changing a flag in a JSON column in an SQL database.

@vovavili
Copy link

thank you so much it works great also I would like to tell anyone that is reading this that don't update the cold turkey they rectify these loop holes and you have to wait for the crack everytime

bro can you help do this cause i am not that techy person

https://www.youtube.com/watch?v=enfCPH_2k6A

@DilankaGunasekara
Copy link

Thank you

@kagankrc
Copy link

Thank you :)

@isan0786
Copy link

isan0786 commented May 5, 2024

It works, Thank you so much!

@rogerjv95
Copy link

Thank you so much!

@hassaneseo
Copy link

Bro, thank you very much, it works like a charm. I am a blogger and I really need this. It's so hard to be disciplined and get the work done when you work for yourself.

@fantasygone
Copy link

It works and it's a bit bittersweet that it does, makes you think if they did it on purpose

@safia-nusrat-official
Copy link

to which dir we have to open cmd? "C:/ProgramData/Cold Turkey/data-app.db" this?

@matke203
Copy link

i don't know if i'm stupid or what but I can't seem to run the code, i'm getting indentation errors, syntax errors, cold turkey is not installed etc.
this is my first time using python and I watched a few youtube videos and tried some stuff but just can't run the code

@matke203
Copy link

i don't know if i'm stupid or what but I can't seem to run the code, i'm getting indentation errors, syntax errors, cold turkey is not installed etc. this is my first time using python and I watched a few youtube videos and tried some stuff but just can't run the code

okay I somehow got it to work idk how, thank you very much

@Stiven106
Copy link

You're a genius man, thanks!

@claudiaclaudiaclaudia
Copy link

Thank you so much, now I can schedule my blocks on Cold Turkey!

@PratikDahal-01
Copy link

Working Thanks Mate

@lisan-al-ghaib
Copy link

lisan-al-ghaib commented Oct 2, 2024

I ran the code and checked to see that ProStatus is set to pro, but it still isnt activated for some reason. Any idea what the issue could be? tries it on version 4.3 btw

@Serminx
Copy link

Serminx commented Oct 9, 2024

I ran the code but it still isnt activated for some reason, my mistake for sure
edit: it works thank you so muchh, I really need this

@jalalcool12345
Copy link

I ran the code but it still isnt activated for some reason, my mistake for sure edit: it works thank you so muchh, I really need this

can u pls help me it doesnt work. i put the python in the directory and i opened the cmd in the directorry and i pasted the code in the cmd. but it stil ldoesnt work

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