Skip to content

Instantly share code, notes, and snippets.

@jpramosi
jpramosi / pythonx
Last active September 5, 2024 12:06
Utility bash script to run python in venv.
#!/bin/bash
# pythonx init
# pythonx -m pip install numpy
# pythonx script.py
function on_exit {
deactivate
}
@jpramosi
jpramosi / cfg
Created October 27, 2022 17:00
Helper utility for shell scripts to read or modify configuration files like .ini, .toml or .conf
#!/bin/python3
"""
Config-Util - Helper utility for shell scripts to read or modify
configuration files like .ini, .toml or .conf
Copyright (C) 2022 Jimmy Pramosi <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
@jpramosi
jpramosi / fix-poetry-linting.py
Created October 26, 2022 16:51
This script will fix poetry imports from virtual environment for pylint and pylance linter.
# tested only on ubuntu21.04
import os
import sys
from ast import literal_eval
from configparser import ConfigParser
from glob import glob
from pathlib import Path
import fileinput
INIT_HOOK = """
@jpramosi
jpramosi / waveshare-7HP-CAPQLED.py
Created April 11, 2022 06:08
Waveshare brightness control via hidraw. Other models with hidraw support may also work.
#!/usr/bin/python3
"""
usage:
python waveshare-7HP-CAPQLED.py --brightness 1
python waveshare-7HP-CAPQLED.py --hidraw 0 --brightness 9
"""
import os
import argparse
import array
@jpramosi
jpramosi / update-ca-certificates-fix
Created December 25, 2021 15:04
A fixed version that doesn't crash the plasma desktop environment (atleast for me)
#!/bin/sh -e
#
# update-ca-certificates-fix
#
# Copyright (c) 2003 Fumitoshi UKAI <[email protected]>
# Copyright (c) 2009 Philipp Kern <[email protected]>
# Copyright (c) 2021 jpramosi <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@jpramosi
jpramosi / mkvm.sh
Last active November 6, 2021 01:49
Setup script for creating virtual machines with VirtualBox on Linux based operating systems
#!/bin/bash
# Simple setup script for creating virtual machines with VirtualBox on Linux based operating systems.
# e.g:
# ./mkvm -n server -d 50000 -r 2048 -c 2 -o Ubuntu_64 -i ubuntu-20.04.3-live-server-amd64.iso
VM_INFO=`VBoxManage list systemproperties | grep folder`
VM_PATH=${VM_INFO##* }
NAME=;
SIZE=;
RAM=;
CPU=;
@jpramosi
jpramosi / x11-mouse-listener.py
Last active May 8, 2021 00:38
simple mouse listener for x window system
import math
from enum import Enum
from threading import Thread, Lock
from time import sleep
from Xlib.display import Display
from Xlib import X
from Xlib.ext.xtest import fake_input
from Xlib.ext import record
from Xlib.protocol import rq
@jpramosi
jpramosi / github.css
Created July 31, 2020 13:36
old compact github style css
/*
This is a modified version of https://github.com/MCHSL/sane-github/
*/
/* Header */
.Header.py-md-0 {
margin: auto;
width: 69%;
}