Skip to content

Instantly share code, notes, and snippets.

View monperrus's full-sized avatar

Martin Monperrus monperrus

View GitHub Profile
@monperrus
monperrus / systray-notes.py
Created March 16, 2025 10:07
a python systray application that adds a list of items in system tray icon
#!/usr/bin/python
# a systray app for my notes (tomboy + joplin)
import pystray
from PIL import Image
import tkinter as tk
from tkinter import simpledialog
import os
import joplin_notes
import tomboy
@monperrus
monperrus / ls-repos.py
Created March 16, 2025 10:07
python script to list github repos of a user ordered by last update
#!/usr/bin/python3
import requests
import datetime
import argparse
from typing import List, Dict, Any
def get_user_repos(username: str) -> List[Dict]:
"""
Fetch all repositories for a given GitHub username.
@monperrus
monperrus / process_age.py
Created March 16, 2025 10:06
get age of process in python
#!/usr/bin/python3
# get process age in second
import psutil
import time
import sys
import datetime
def get_process_age(pid):
try:
# Get the process object
process = psutil.Process(pid)
@monperrus
monperrus / run-tests.py
Created March 16, 2025 10:06
a python script to identify the type of build and tests in the current directory and run the tests accordingly (ex maven test for maven, etc)
#!/usr/bin/env python3
import os
import subprocess
import sys
def run_command(command):
"""Run a shell command and return the result."""
try:
print(f"Executing: {' '.join(command)}")
@monperrus
monperrus / github-search.py
Last active March 16, 2025 10:06
a python script to call the github search api looking for code
#!/usr/bin/python
import requests
import json
import os
import time
def search_github_code(query, language=None, sort=None, order=None, per_page=30, page=1):
"""
Search for code on GitHub using the GitHub Search API.
@monperrus
monperrus / notes.md
Last active February 11, 2025 20:20
notes on compiling mongodb v8 on Ubuntu 22 Jammy (Feb 2025)

git clone https://github.com/mongodb/mongo.git
cd mongo
git checkout r8.0.4

scons

@monperrus
monperrus / recollq.py
Created February 8, 2025 11:40
Recollq with JSON output
#!/usr/bin/python3
"""
Recoll Query Tool with Base64 Decoder
This script provides a command-line interface to search using Recoll and decode base64-encoded fields
in the results. It returns the results as structured JSON where alternating words are treated as
key-value pairs, with values being base64-decoded.
Features:
- Command-line interface for Recoll searches
@monperrus
monperrus / notes.md
Last active January 18, 2025 09:15
Notes on Microsoft Exchange auto-importer of meeting invitations in calendar

Notes on Microsoft Exchange auto-importer of meeting invitations in calendar

  1. It imports the email subject as meeting title (not the SUMMARY field of the invitation)
  2. It requires that the organizer email (the ORGANIZER field of the invitation) is the same as the sender email
@monperrus
monperrus / joplin_systray.py
Created January 12, 2025 07:42
python system tray to show and start joplin notes
#!/usr/bin/python3
# python system tray to show and start joplin notes
# author: Martin Monperrus
# license: public domain
# url: https://gist.github.com/monperrus/6e43a5216179662655c50b901d0d152b
import pystray
from PIL import Image
import tkinter as tk
from tkinter import simpledialog
@monperrus
monperrus / elsevier.json
Created January 11, 2025 03:25
example of elsevier output for a paper curl -H "Accept: application/json" -H "x-els-apikey: xxxxxx" "https://api.elsevier.com/content/article/pii/S0950584924002593"
{
"full-text-retrieval-response" : {
"coredata" : {
"articleNumber" : "107654",
"dc:creator" : [
{
"$" : "Qian, Zhongsheng",
"@_fa" : "true"
},
{