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 / 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%;
@paulobunga
paulobunga / rand_pseudocode.js
Created October 1, 2021 09:54
Random Max Number Pseudocode
let array = [];
const generateNumberInRange = (min, max) => {
let number = Math.floor(Math.random() * (max - min + 1)) + min;
return number;
}
//Generate the random array to work with