clean up and org

This commit is contained in:
buenosairesam
2025-05-08 23:40:54 -03:00
parent 0b9f23fafd
commit 242928d502
11 changed files with 197 additions and 96 deletions

View File

@@ -1,13 +0,0 @@
FROM python:3.9-alpine
RUN apk add --update
COPY . /src
WORKDIR /src
RUN
EXPOSE 8080
ENTRYPOINT [""]

View File

@@ -1,4 +0,0 @@
sudo systemctl start mongod.service
. ~/mdir/venvs/deskmeter/bin/activate
cd ~/mdir/python/deskmeter
python3 dmmain.py

10
dmapp/dm.sh Normal file
View File

@@ -0,0 +1,10 @@
sudo systemctl start mongod.service
. /home/mariano/wdir/venv/dm/bin/activate
cd /home/mariano/wdir/def/deskmeter
nohup python3 dmmain.py >dm.out 2>dm.err &
cd /home/mariano/wdir/def/deskmeter/dmapp
nohup python3 run.py >dm.out 2>dm.err &
cd ~
exit

View File

@@ -1,14 +0,0 @@
class ActiveDesktop:
def __init__(self, desktops, unlabeled = "Other"):
self.desktops = desktops
def active_workspace():
workspaces = subprocess.check_output(["wmctrl", "-d"]) \
.decode("utf-8").strip("\n").split("\n")
for workspace in workspaces:
if workspace[3] == "*":
return int(workspace[0])

View File

@@ -4,6 +4,7 @@ import subprocess
import time import time
from pprint import pprint from pprint import pprint
import task
from pymongo import MongoClient from pymongo import MongoClient
from zoneinfo import ZoneInfo from zoneinfo import ZoneInfo
@@ -22,38 +23,9 @@ dailies = db.daily
desktops = ("Plan", "Think", "Work", "Other", "Away", "Work", "Work") desktops = ("Plan", "Think", "Work", "Other", "Away", "Work", "Work")
task_file = "/home/mariano/LETRAS/org/task/main"
# desktops = ("Admin",
# "Learn",
# "Tasks",
# "Other",
# "Text",
# "Video",
# "Away")
unlabeled = "Away" unlabeled = "Away"
def extract(line):
if line.rstrip().endswith("*"):
pipe_index = line.find("|")
if pipe_index != -1 and len(line) > pipe_index + 8:
value = line[pipe_index + 1 : pipe_index + 9]
return value
return None
def read_and_extract(file_path):
with open(file_path, "r") as file:
for line in file:
value = extract(line)
if value:
return value
return None
def active_workspace(): def active_workspace():
workspaces = ( workspaces = (
subprocess.check_output(["wmctrl", "-d"]) subprocess.check_output(["wmctrl", "-d"])
@@ -75,7 +47,7 @@ def desktop(workspace_index):
current_workspace = active_workspace() current_workspace = active_workspace()
current_task = read_and_extract(task_file) current_task = task.current()
last_switch_time = now() last_switch_time = now()
switch = { switch = {
@@ -88,7 +60,7 @@ switch = {
switches.insert_one(switch) switches.insert_one(switch)
while True: while True:
current_task = read_and_extract(task_file) current_task = task.current()
current_workspace = active_workspace() current_workspace = active_workspace()
last_doc = switches.find_one(sort=[("_id", -1)]) last_doc = switches.find_one(sort=[("_id", -1)])

View File

@@ -0,0 +1,161 @@
work
default | ffbe198e *
vhs | c851ce32
dlt | b4378ac5
???
think
lectura
guitarra
design patterns
data structures
politica
cursos
code
microsaas
soft
oratoria
memoria |1dc8a7c2
video
blender
motion graphics
unreal
houdini
nuke
plan
entrevistas
rapid fort |00799f93
calestino |f58a2919
celara |64898a2f
work
boat
spots |5fc751ec
dani: si mejor extraer dl y sfr manual
revisar ami -|
publisher
mapear codigo |462682ac
credentials
completar lista |d602b2d8
simulations
reunion caro
OCIO class |f6f23db6
generar cache
dani: tracker / entity
graph?
averiguar opciones |9d794a0b
personal
deskmeter |ec01a5a8
autoweekcal
frontend apps
qt / wxwidgets / c
android remote control
react native
meetdrop
qtbase
100ms
portfolio
subtitulos
encript
video
script canon linux
audio
compresor obs
configurar hydrogen
musica
piano
liebestraum
arpegios and scales
AbM
course exercises
encoding
storing
retrieve
write chords
sonata
arpegios and scales
C#m
course exercises
encoding
storing
retrieve
write chords
guitar
surf riders
dance
elegir videos
plan
hablar con kimda para actualizar sombrero
habilitar obsidian j
work
config aws cli for boat/mcrn
just start/stop ecs
api
spoty
think on the interview
design patterns
algos and ds
maxi |9f551a34
alinear month/date
scroll, recenter (today)
align sum
show 3M before / 9M after
dlt
whatsapp |f217b606
seo and analytics |7422cfe3
dockerizar |acbd9f7f
landing page |9719a462
documento |c6b0af75
carga |be7e496f
update look |51c5b6d6
instagram ads |76e7b629
wrap up |92014034

23
dmapp/dmcore/task.py Normal file
View File

@@ -0,0 +1,23 @@
task_file = "/home/mariano/LETRAS/org/task/main"
def extract(line):
if line.rstrip().endswith("*"):
pipe_index = line.find("|")
if pipe_index != -1 and len(line) > pipe_index + 8:
value = line[pipe_index + 1 : pipe_index + 9]
return value
return None
def read_and_extract(file_path):
with open(file_path, "r") as file:
for line in file:
value = extract(line)
if value:
return value
return None
def current():
return read_and_extract(task_file)

View File

@@ -1,4 +0,0 @@
sudo systemctl start mongod.service
. ~/mdir/venvs/deskmeter/bin/activate
cd ~/mdir/python/deskmeter/dmapp
python3 run.py

View File

@@ -1,20 +0,0 @@
app:
build: .
command: python -u app.py
ports:
- "5000:5000"
volumes:
- .:/app
links:
- db
db:
image: mongo:latest
hostname: test_mongodb
environment:
- MONGO_INITDB_DATABASE=<mongo_database>
- MONGO_INITDB_ROOT_USERNAME=<mongo_username>
- MONGO_INITDB_ROOT_PASSWORD=<mongo_password>
volumes:
- ./init-db.js:/docker-entrypoint-initdb.d/init-db.js:ro
ports:
- 27017:27017

View File

@@ -1,2 +0,0 @@
check weird thing of not showing the workspace where you start the dmmain script unless you move the window around
solve the bug of falsely counting the workspace you are on, because it counts from the last switch (once you switch it shows correctly)

View File

@@ -1,8 +0,0 @@
def active_workspace():
workspaces = subprocess.check_output(["wmctrl", "-d"]) \
.decode("utf-8").strip("\n").split("\n")
for workspace in workspaces:
if workspace[3] == "*":
return int(workspace[0])