Skip to content

Instantly share code, notes, and snippets.

View boulama's full-sized avatar
💭
69 + 42

Boulama K. boulama

💭
69 + 42
View GitHub Profile
@boulama
boulama / README.md
Created January 12, 2024 07:59
ESP32 code connects to Wi-Fi, uses a motion sensor to control LEDs, and interacts with the Govee API to retrieve and manipulate device based on motion detection. Motion sensor: am312.
@boulama
boulama / gist:f1f8af10c6f419cfe40e217d6d6d6184
Last active November 23, 2023 21:17
Loop through a given folder and return all image files from that folder
image_files = [f for f in os.listdir(input_folder) if f.lower().endswith(('.png', '.jpg', '.jpeg', '.gif', '.bmp'))]
@boulama
boulama / framedrop.cpp
Created November 10, 2023 04:55
change video framerate in c++
#include <opencv2/opencv.hpp>
int main() {
std::string inputVideoPath = "in_vid.mp4"; // Input video file
std::string outputVideoPath = "out_vid.mp4"; // Output video file with the desired frame rate
// Open the input video file
cv::VideoCapture inputVideo(inputVideoPath);
@boulama
boulama / drive.py
Last active May 29, 2023 22:50
This code controls a robot's movement by taking user input and controlling the GPIO pins of a Raspberry Pi to drive the motors in different directions.
import RPi.GPIO as GPIO
from time import sleep
import curses
# Define GPIO pin numbers
RIGHT_FORWARD_PIN = 17
RIGHT_BACKWARD_PIN = 18
RIGHT_ENABLE_PIN = 4
LEFT_FORWARD_PIN = 22
@boulama
boulama / transducer.ipynb
Created February 3, 2023 17:08
transducer.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@boulama
boulama / transducer.ino
Last active October 17, 2023 17:10
pressure transducer code
#include "Wire.h" //allows communication over i2c devices
const int sensorPin = A0;
float sensorVal = 0;
float p_max = 5000;
float p_min = 0;
float v_max = 5;
float v_min = 0;
@boulama
boulama / listjpgs.py
Created February 3, 2023 05:47
list all jpg images from folders recursively
def get_jpgs(path):
jpgs = []
for root, dirs, files in os.walk(path):
for file in files:
if file.endswith('.jpg'):
jpgs.append(os.path.join(root, file))
return jpgs
@boulama
boulama / flexure.py
Last active October 21, 2022 03:22
Code used to analyze flexure (flexure.py) and Impact (impact.py) from experimental data.
import pandas as pd
import matplotlib.pyplot as plt
import re
def camel_case_split(str):
return re.sub(r'((?<=[a-z])[A-Z]|(?<!\A)[A-Z](?=[a-z]))', r' \1', str)
f = [
@boulama
boulama / getCertificate.js
Last active October 4, 2022 08:05
Create PDF with picsapi.com (google app script code)
function getCertificate(name, date) {
//=getCertificate(B2,C2)
var formData = {
transformations: {
date:{text:date},
name:{text:name}
},
template_id:'<template-id>',
format:'pdf'
}
@boulama
boulama / feedbucket-tinq-webhook.php
Created April 26, 2022 08:40
feedbucket webhook
<?php
use GuzzleHttp\Client;
$client = new Client();
$data = json_decode($request->getContent(), true);
$action = $data['action'];
$feedback = $data['feedback'];
$project = $feedback['project'];
$reporter = $feedback['reporter'];