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 / README.md
Created February 22, 2022 15:57 — forked from dims/README.md
Kubernetes Resources
@afro-coder
afro-coder / index.js
Last active February 16, 2022 16:06
Cloudfront function to rewrite and redirect to a different location
function handler(event) {
var request = event.request;
var uri = request.uri;
if (uri.startsWith('/api')) {
uri=uri.replace('/api/','')
var newurl = `https://backend-url/${uri}`
var response = {
// The status code is important.
@afro-coder
afro-coder / Containerfile
Created December 27, 2021 07:45
Squid Proxy with Kubernetes k3s Raspberry Pi4
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"]
@afro-coder
afro-coder / SFtoMS.go
Created October 25, 2021 15:16
Pull Data from Salesforce and push to MS teams
package main
import (
"bytes"
"encoding/json"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
@afro-coder
afro-coder / main.go
Created October 25, 2021 15:08
Gist to read data from Salesforce and push to Microsoft Teams
package main
import (
"bytes"
"encoding/json"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
@afro-coder
afro-coder / podman-from-source
Last active May 16, 2021 10:44
Podman from source
# script-name build_dir
#
dnf config-manager --set-enabled powertools
dnf install https://mirror.rackspace.com/elrepo/elrepo/el8/x86_64/RPMS/elrepo-release-8.2-1.el8.elrepo.noarch.rpm
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
afro-coder / resticheat.md
Created January 23, 2021 13:08 — forked from perfecto25/resticheat.md
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
afro-coder / mariadb-notes.txt
Created January 17, 2021 18:31
galera-4 is needed by Mariadb
galera-4 for centos is not in any repo except this.
https://yum.mariadb.org/10.5/centos7-amd64/rpms/
https://mariadb.com/kb/en/source-building-mariadb-on-centos/
Steps to build Mariadb RPMS
cmake -DRPM=centos7 server/
make package -j4
@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();