Skip to content

Instantly share code, notes, and snippets.

@dmynerd78
dmynerd78 / laptop_uptime.py
Last active August 16, 2020 23:31
A quick and dirty Python script that writes to a file how long it's been running. Useful for measuring laptop lifetime when on battery (which is what I used it for)
from time import sleep
from datetime import datetime
"""
To read back JSON file:
Datetime str format: %Y-%m-%d %H:%M:%S.%f
datetime.strptime(datetime_string, "%Y-%m-%d %H:%M:%S.%f")
"""
SLEEP_TIME = 3
@dmynerd78
dmynerd78 / archive.bat
Created June 7, 2020 18:31
Windows 7-Zip Backup Script
@echo OFF
REM Sets %$date% to M-D-YYYY
set $date=%date:~4%
set $date=%$date:/=-%
REM =========== CONFIG ===========
set COMPRESS_7Z_LOCATION="C:\Program Files\7-Zip\7zG.exe"
@dmynerd78
dmynerd78 / git-cheatsheet.md
Last active August 30, 2020 22:29
Git Cheatsheet
@dmynerd78
dmynerd78 / change_power_plan.py
Last active September 16, 2015 02:00
Run this file to quickly change your Windows power plan! (Will not work if your power plan has consecutive spaces in it (example: ' ')) It's a bit messy. Sorry about that
import os, sys
power_plans_data = []
available_power_plans = {}
input("\033[1;41mNOTE: If any of your power plans has more than one space in the name this program will NOT work!\n"
"Hit enter to continue\033[0m ")
power_plans = os.popen("powercfg /list").read()