Skip to content

Instantly share code, notes, and snippets.

View mugendi's full-sized avatar

Anthony Mugendi mugendi

  • Nairobi, Kenya
View GitHub Profile
@mugendi
mugendi / replace-svg.js
Created May 19, 2024 21:51
Replace SVG Image with PNG
function svgToPNG(svg) {
return new Promise((resolve, reject) => {
let img = document.createElement("img");
let finalImg = document.createElement("img");
let svgSize = svg.getBoundingClientRect();
let canvas = document.createElement("canvas");
canvas.width = svgSize.width;
canvas.height = svgSize.height;
let ctx = canvas.getContext("2d");
#!/usr/bin/bash
# DEPRECATED!!!!!!!!!!!! See https://github.com/mugendi/poetry-project-scaffold
# BASED ON
# 1. https://medium.com/mlearning-ai/how-to-start-any-professional-python-package-project-9f66538ebc2
unameOut=$(uname -a)
case "${unameOut}" in
*Microsoft*) OS="WSL" ;; #must be first since Windows subsystem for linux will have Linux in the name too
@mugendi
mugendi / Monit Config Creator for PM2 - Better!
Last active January 27, 2019 02:43
Simple Bash Script that creates a monit config script from your PM2 Processes. Run using ./script.sh [-m YOUR_MONIT_DIR]
#!/bin/bash
# Some utility functions....
trailing_slash () {
STR="${1}"
length=${#STR}
last_char=${STR:length-1:1}
[[ $last_char != "/" ]] && STR="$monitDir/";
echo $STR;
@mugendi
mugendi / Monit Config Creator for PM2
Last active January 26, 2019 22:55
Simple Bash Script that creates a monit config script from your PM2 Processes. Run using ./script.sh [-m YOUR_MONIT_DIR]
#!/bin/bash
# Some utility functions....
trailing_slash () {
STR="${1}"
length=${#STR}
last_char=${STR:length-1:1}
[[ $last_char != "/" ]] && STR="$monitDir/";
accountsservice install
acpid install
adduser install
amd64-microcode install
apparmor install
apt install
apt-utils install
aptitude install
aptitude-common install
base-files install