Skip to content

Instantly share code, notes, and snippets.


Leon(@mediocreDevops) afro-coder

View GitHub Profile
afro-coder /
Created Jun 9, 2018
Click using flask application factory (With different configurations)
I'm really new to python and flask so this maybe terribly wrong but it works at least for me
python --config {{your config}} command
It also prompts just in case you forget.
The ctx object from the click documentation along with the '@click.pass_context helps to push the app variable through
all the functions.
View gist:10d64459043e74770c36f98b690ceb5c
import gzip
import json
import re
import os
import datetime
import pprint
import argparse
from collections import OrderedDict
class _RegEx:
afro-coder /
Created May 8, 2020
Using tika to process pdfs
# This will remove the manual work of copying the file names
# You can run this in batches to processes it
# pip install --user tika to download the tika library
# the first run will download tika.jar
from tika import parser
#parse the pdf
afro-coder /
Last active Nov 21, 2020
Using Google Sheet API and Google Chat Webhooks to make my life easier
// Function was taken from
function getCurrentUserEmail() {
var userEmail = Session.getActiveUser().getEmail();
if (userEmail === '' || !userEmail || userEmail === undefined) {
userEmail = PropertiesService.getUserProperties().getProperty('userEmail');
if (!userEmail) {
var protection = SpreadsheetApp.getActive().getRange('A1').protect();
var editors = protection.getEditors();
afro-coder / exenta_automator.js
Created Dec 20, 2020
Automating exenta and RadDatepicker using Javascript
View exenta_automator.js
// Click on Apply for WFH button
//Set the WFH type
// Day type
afro-coder / mariadb-notes.txt
Created Jan 17, 2021
galera-4 is needed by Mariadb
View mariadb-notes.txt
galera-4 for centos is not in any repo except this.
Steps to build Mariadb RPMS
cmake -DRPM=centos7 server/
make package -j4
afro-coder /
Created Jan 23, 2021 — forked from perfecto25/
Restic cheatsheet

Restic backup application - commands cheatsheet

Installation & config

  1. add Retic repo
  2. yum install restic

add a Restic credential file to root

vim /root/.restic
afro-coder / podman-from-source
Last active May 16, 2021
Podman from source
View podman-from-source
# script-name build_dir
dnf config-manager --set-enabled powertools
dnf install
dnf --enablerepo=elrepo-testing install btrfs-progs-devel
dnf -y update
dnf install -y btrfs-progs-devel\
conmon \
containernetworking-plugins \
containers-common crun \
afro-coder / main.go
Created Oct 25, 2021
Gist to read data from Salesforce and push to Microsoft Teams
View main.go
package main
import (
afro-coder / Containerfile
Created Dec 27, 2021
Squid Proxy with Kubernetes k3s Raspberry Pi4
View Containerfile
FROM alpine
RUN apk update && apk add squid
COPY ./squid.conf /etc/squid.conf
RUN squid -z && squid -k check
CMD ["squid","--foreground","-f","/etc/squid.conf"]