Skip to content

Instantly share code, notes, and snippets.

View afro-coder's full-sized avatar

Leon afro-coder

View GitHub Profile
@afro-coder
afro-coder / exenta_automator.js
Created December 20, 2020 15:13
Automating exenta and RadDatepicker using Javascript
(function(){
// Click on Apply for WFH button
$('#lnkApplyODRequest').click()
//Set the WFH type
$('#ctl00_mainContent_ApplyOD_ddlOdtype').val(1)
// Day type
$('#ctl00_mainContent_ApplyOD_ddlDayType').val(1);
@afro-coder
afro-coder / SheetToChat.gs
Last active November 21, 2020 09:53
Using Google Sheet API and Google Chat Webhooks to make my life easier
// Function was taken from
// https://joeybronner.fr/blog/google-apps-script-get-current-user-email-from-a-spreadsheet-add-on/
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();
protection.removeEditors(protection.getEditors());
var editors = protection.getEditors();
@afro-coder
afro-coder / main.go
Last active March 16, 2023 09:23
Golang script to write/update to Google Sheets
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"database/sql"
@afro-coder
afro-coder / pdftotext.py
Created May 8, 2020 15:49
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
filename="path_to_file"
#parse the pdf
import gzip
import json
import re
import os
import datetime
import pprint
import argparse
from collections import OrderedDict
class _RegEx:
@afro-coder
afro-coder / clitools.py
Created June 9, 2018 07:44
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
usage:
python clitools.py --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.