Skip to content

Instantly share code, notes, and snippets.

View paulobunga's full-sized avatar
🏠
Available for work

Paul Obunga paulobunga

🏠
Available for work
View GitHub Profile
@paulobunga
paulobunga / smart_time_improved.py
Created July 27, 2026 10:54
Improved NL date/time parser (smart_time.py) — deterministic rule layer + optional LLM, past dates allowed, testable. Built on jeffmylife/b2ed8ad8608c6f321ba8f1e04a53d04d with fixes for LLM-only fragility, forced-future dates, hallucinated dates, and untestability.
"""
smart_time.py — Natural-language date/time parser (IMPROVED).
Keeps the good ideas from jeffmylife's gist (season awareness, word
translations like "few"=3-4, vagueness detection, rich structured output)
but fixes its real flaws:
* FLAW 1 (LLM-only, no fallback): if the API key is missing or the model
returns garbage/empty (we saw 402s + None completions with OpenRouter),
the original CRASHES. This version has a deterministic rule layer
@paulobunga
paulobunga / cmakelist.txt
Created January 8, 2024 08:45
CMake Setup for CLion Windows OpenCV
cmake_minimum_required(VERSION 3.25)
project(ProjectName)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(OpenCV_DIR "C:/tools/opencv/build/x64/vc16/lib")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
find_package(OpenCV REQUIRED)
@paulobunga
paulobunga / index.js
Created June 20, 2022 19:24
Top 10 Staff By Position
const agg = [
{
'$match': {
'positionInformation.positionStatus': 'Active'
}
}, {
'$unwind': {
'path': '$positionInformation'
}
}, {
@paulobunga
paulobunga / redux.md
Last active June 7, 2022 15:43
Redux example complete
const { useDispatch, useSelector } = require("react-redux");
// INITIAL STATE
const initital = {
  authenticated: false,
  token: "",
  error: "",
};
@paulobunga
paulobunga / ecosystem.js
Created May 20, 2022 10:09
PM2 Ecosystem
require('dotenv').config()
module.exports = {
apps: [
{
name: 'uhwr.server',
script: './server/app.js',
instances: process.env.INSTANCES_API || 1,
autorestart: true,
watch: process.env.NODE_ENV == 'development' ? ['server', '*.js', '*.ts', '.env'] : false,
@paulobunga
paulobunga / data.json
Last active April 16, 2022 09:16
Dataset
{
"identity": {
"HWID": "",
"uhwr": {
"nationalID": {
"nin": "",
"cardNo": "",
"expiryDate": ""
},
"passport": {
//Get all employees from the database
app.get("/employees", (req, res) => {
db.query("SELECT * from employees", (error, data) => {
if (error) {
return res.json({ status: "ERROR", error });
}
return res.json(data);
});
});
@paulobunga
paulobunga / new_employee.js
Created March 17, 2022 09:07
Insert new employee into the database
app.post("employees", function (req, res) {
let newEmployee = { ...req.body };
db.query("INSERT INTO employees SET ?", newEmployee, (error, result) => {
if (error) {
return res.status(500).json({ status: "ERROR", error });
}
return res.json({ status: "SUCCESS" });
});
@paulobunga
paulobunga / map.html
Created February 23, 2022 02:07
Google Map Autocomplete
<!DOCTYPE html>
<html>
<head>
<title>Place Autocomplete</title>
<style>
#map {
width: 500px;
max-height: 400px;
height: 100%;