Skip to content

Instantly share code, notes, and snippets.

View gcleaves's full-sized avatar

Geoffrey Cleaves gcleaves

  • Barcelona, Spain
View GitHub Profile
@gcleaves
gcleaves / timesheet.py
Created May 21, 2025 19:22
Automated timesheet entry script for BambooHR
#!/usr/bin/env python3
"""
timesheet.py - Automated timesheet entry script for BambooHR
This script automates the process of submitting timesheet entries to BambooHR.
It allows users to submit multiple workdays of time entries with customizable
time slots for weekdays and Fridays.
Getting an API key: https://documentation.bamboohr.com/docs/getting-started#authentication
@gcleaves
gcleaves / oauth_providers.py
Created November 16, 2024 21:58
Chainlit Keycloak
import base64
import os
import urllib.parse
from typing import Dict, List, Optional, Tuple
import httpx
from chainlit.secret import random_secret
from chainlit.user import User
from fastapi import HTTPException
@gcleaves
gcleaves / rotate.sh
Created January 6, 2024 18:41
Rotate a phone video
ffmpeg -i input.mp4 -c copy -metadata:s:v:0 rotate=180 output.mp4
@gcleaves
gcleaves / bots.json
Last active February 19, 2023 09:25
[{
"domain": "amazon.sa",
"detection": "warning",
"monitor": "ok",
"tdt": "severe",
"issues": "images are not being extracted, things are not working"
},
{
"domain": "amazon.es",
"detection": "ok",
@gcleaves
gcleaves / Create_Laravel_Pipeline.txt
Last active January 8, 2022 11:40 — forked from omaryoussef/Create_Laravel_Pipeline.txt
Creates a Filebeat pipeline to ingest Laravel Monolog/log lines.
PUT _ingest/pipeline/laravel
{
"description": "Parses Laravel log files.",
"processors": [
{
"rename": {
"field": "message",
"target_field": "event.original"
}
},
@gcleaves
gcleaves / android_gateway.txt
Last active December 7, 2024 08:55
Wireguard peer as internet gateway, using Android USB tethering
# attempt 6, success
# relies on Magisk auto start script
# pause script to give wireguard time to autostart
bullhead:/ # cat /data/adb/service.d/prep_gateway.sh
#!/system/bin/sh
sleep 2m
su -c 'iptables -F tetherctrl_FORWARD'
su -c 'sysctl -w net.ipv4.ip_forward=1'
su -c 'iptables -A FORWARD -i tun0 -j ACCEPT'
su -c 'iptables -t nat -A POSTROUTING -o rmnet_data0 -j MASQUERADE'
@gcleaves
gcleaves / 0.Maxscale regex
Last active January 8, 2018 12:38
Problematic Maxscale 2.1.2 regex filter
# This throws an error
[OfferRevenueSuspicion]
type=filter
module=regexfilter
options=ignorecase
match=INNER JOIN\s*\(\s*SELECT `fact_susp_conversions`.`offer_id` AS `offer_id`,\s*SUM\(`fact_susp_conversions`.`revenue`\) AS `__measure__0`\s*FROM `fact_susp_conversions`\s*LEFT JOIN `dim_conversion_suspicion` ON \(`fact_susp_conversions`.`impression_id` = `dim_conversion_suspicion`.`impression_id`\)\s*LEFT JOIN `dim_offer_suspicion` ON \(\(`fact_susp_conversions`.`offer_id` = `dim_offer_suspicion`.`offer_id`\) AND \(`dim_conversion_suspicion`.`suspicion_code` = `dim_offer_suspicion`.`suspicion_code`\)\)\s*LEFT JOIN `dim_advertiser_suspicion` ON \(\(`fact_susp_conversions`.`advertiser_id` = `dim_advertiser_suspicion`.`advertiser_id`\) AND \(`dim_conversion_suspicion`.`suspicion_code` = `dim_advertiser_suspicion`.`suspicion_code`\)\)\s*LEFT JOIN `dim_offer` ON \(`fact_susp_conversions`.`offer_id` = `dim_offer`.`natural_key`\)\s*LEFT JOIN `dim_advertiser` ON \(`fact_susp_conversions`.`advertiser_id` = `dim_adverti
@gcleaves
gcleaves / mysql_date_trunc
Last active August 26, 2015 16:12 — forked from mtrbean/mysql_date_trunc
MySQL date_trunc equivalent
DATE_TRUNC('week', now()) === STR_TO_DATE(CONCAT(YEARWEEK(now(), 2), ' Sunday'), '%X%V %W')
DATE_TRUNC('month', now()) === DATE_FORMAT(now(), '%Y-%m-01')