Skip to content

Instantly share code, notes, and snippets.

View Amourspirit's full-sized avatar

:Barry-Thomas-Paul: Moss Amourspirit

  • Huntsville, Ontario, Canada
View GitHub Profile
@Amourspirit
Amourspirit / office.py
Last active June 10, 2023 20:04
Start the LibreOffice (FlatPak) in a virtual environment.
"""
This module is used to start the LibreOffice (FlatPak) in a virtual environment.
When this script is run, it will start the LibreOffice (FlatPak) and include
the virtual environment's site-packages directory in the PYTHONPATH.
In short when this module is included in the root of a project with a virtual environment
then the LibreOffice (FlatPak) will be able to import the project's modules installed with pip.
Usage:
python office.py [options] [app]
@Amourspirit
Amourspirit / README.md
Created May 28, 2023 16:28 — forked from Foadsf/README.md
Scripting LibreOffice with Python

This tutorial was originally written by Jannie Theunissen on onesheep.org. However, the website has been down for a while and this a clone from the web.archive.org backup. Also, the parts regarding the macOS are updated according to this post. You may find OneSheep here on Twitter and Jannie Theunissen here on StackOverflow. If you have any comments on this Gist please poke me here on Twitter, otherwise, I might miss your comments.

Scripting LibreOffice with Python

We were recently asked to automate some editing tasks for the Spotlight English editors w

@Amourspirit
Amourspirit / LibreOffice Virtual Environment using venv and oooenv.md
Last active May 7, 2023 16:54
General python guidelines for setting up a virtual environment to work with LibreOffice

Python LibreOffice virtual Environment

General python guidelines for setting up a virtual environment to work with LibreOffice

Note: OOO Development Tools is a python package that already does most of the heavy lifting for working with Python and LibreOffice.

Recommend reading OOO Development Tools Developer Docs

Project Setup

@Amourspirit
Amourspirit / vscode_sphinx_debug.md
Last active June 13, 2022 23:54
How to debug Shinx Docs in VS Code

How to debug Shinx Docs in VS Code

In VS Code add a new configuration to launch json.

Open launch.json ctl+shirt+p and type launch.json. From there you can open launch.json.

The revelent section is to add to your launch.json is Python: Sphinx Docs

{
@Amourspirit
Amourspirit / common_color.py
Created June 3, 2022 01:20
Python Web Colors Constants
class CommonColor:
# Pink colors
MEDIUM_VIOLET_RED = 0xC71585
DEEP_PINK = 0xFF1493
PALE_VIOLET_RED = 0xDB7093
HOT_PINK = 0xFF69B4
LIGHT_PINK = 0xFFB6C1
PINK = 0xFFC0CB
# red colors
@Amourspirit
Amourspirit / QuickConda.md
Last active April 17, 2022 19:45
Conda (cheatsheet) Quick Commands

Quick Commands

Set up env
$ conda env create --prefix ./env -f environment.yml

Set up new env
$ conda create --prefix ./env python=3.10

Write env to Yaml
$ conda env export > environment.yml

@Amourspirit
Amourspirit / stringUTFArray.js
Created July 31, 2020 16:11
Functions to convert string to UTF8 Array and Array to UTF8 String
function stringToUTF8Array(str) {
let utf8 = [];
for (let i = 0; i < str.length; i++) {
let charcode = str.charCodeAt(i);
if (charcode < 0x80) utf8.push(charcode);
else if (charcode < 0x800) {
utf8.push(0xc0 | (charcode >> 6),
0x80 | (charcode & 0x3f));
}
else if (charcode < 0xd800 || charcode >= 0xe000) {
<?php
/**
* Add WooCommerce cart to Main Menu for Divi
*
* Add WooCommerce cart icon to right of main menu
*/
// Author Paul Moss
// Created September 13 2019
// Append cart item (and cart count) to end of main menu.
<?php
/**
* WooCommerce Match Canada Postal Codes
*
* Checks WooCommerce Postal Code and removes gateways if not matching Canada Postal Format
*/
add_filter( 'woocommerce_available_payment_gateways', function( $available_gateways ){
global $woocommerce;
if ( is_admin() ) {
@Amourspirit
Amourspirit / grunt.copy.includeFile.js
Last active June 14, 2019 11:26 — forked from purtuga/grunt.copy.includeFile.js
A Grunt Copy process function to embed content of files into other files.
/**
* includeFile() - embeds a file content within another. Meant to be
* used from the copy task as a 'processContent' function. The following
* tokens can be used in files: <br>
*
* - BUILD_INCLUDE('file')
* - /* BUILD_INCLUDE('file') *\x47
* - &lt;!-- BUILD_INCLUDE("file") --&gt;
*
* In addition, options can be added to the token above that further