Skip to content

Instantly share code, notes, and snippets.

@viiru-
viiru- / gitlab-issue-sync.el
Last active May 2, 2024 08:08
Create Org mode todo items from Gitlab issues
(defun forge-org-issue-create-or-sync (issue)
(save-window-excursion
(let* ((id (cdr (assoc 'id issue)))
(location (org-id-find id)))
(if location (org-id-goto id)
(forge-org-issue-create issue))
(forge-org-issue-sync-props issue))))
(defun forge-org-issue-sync-props (issue)
(let* ((labels (mapcar (lambda (val) (split-string val "::")) (cdr (assoc 'labels test-issue))))
@viiru-
viiru- / pylsp-debug.py
Created December 19, 2023 07:59
Find out why your pylsp plugins don't load
import logging
from pylsp.config.config import Config
logging.basicConfig(level=logging.DEBUG)
conf = Config(None, None, None, None)
@viiru-
viiru- / Glove80-numpad-layer.kbd.json
Last active January 27, 2024 18:33
Glove80 numpad layer
[
{
"name": "Glove80 numpad layer"
},
[
{
"x": 1,
"a": 7
},
"<i class='kb kb-Multimedia-Play-Pause'></i>",
@viiru-
viiru- / project-git-grep.el
Created October 5, 2023 08:20
Wrapper to default vc-git-grep to the project root
(defun project-git-grep ()
(interactive)
(let* ((pr (project-current t))
(default-directory (project-root pr)))
(call-interactively #'vc-git-grep)))
@viiru-
viiru- / viiru-ement-tracking.el
Last active November 18, 2023 10:13
Ement tracking.el integration
(cl-defun viiru/ement-notify-track (event room session &key (buffer-name "*Ement Notifications*"))
(with-demoted-errors "viiru/ement-notify-track-if-buffer: %S"
(when (ement-notify--event-message-p event room session)
(let ((buffer (if (ement-notify--room-buffer-live-p event room session)
(map-elt (ement-room-local room) 'buffer)
(when (ement-notify--room-unread-p event room session)
(get-buffer buffer-name))))
(faces (if (ement-notify--room-unread-p event room session)
'(ement-room-list-direct)
'(default))))
@viiru-
viiru- / process_usage.py
Last active June 2, 2020 12:38
Script for loading electricity consumption data from several local power companies into Influxdb
#!/usr/bin/python3
import sys
import asyncio
import json
import datetime
from urllib.parse import urljoin
from typing import NamedTuple
import aiohttp
import bs4