Skip to content

Instantly share code, notes, and snippets.

View Arafat245's full-sized avatar

Arafat Arafat245

View GitHub Profile
@Arafat245
Arafat245 / prepare_frame.cpp
Created October 23, 2025 19:54
prepare_data
// -------------------- Payload preparation --------------------
// Format: little-endian float32 (°C), to match the decodeUplink() shown.
static void prepareTxFrame(void) {
float t = temperatureRead(); // ESP32 on-die sensor (not ambient)
last_temp_cX100 = (int16_t) lroundf(t * 100.0f); // keep your existing status display state
// Serialize float32 to little-endian bytes explicitly
static_assert(sizeof(float) == 4, "float must be 4 bytes (IEEE-754)");
uint32_t raw;
memcpy(&raw, &t, sizeof(raw));
@Arafat245
Arafat245 / Train_Test_fold_loop.py
Created May 20, 2025 12:01
Train_Test_fold_loop
df = pd.read_excel(r"C:\Rhythm\test_ds_loc.xlsx")
unique_subjects = df['p_id'].unique()
for subject in unique_subjects:
test_subject_df = df[df['p_id'] == subject].sort_values(by='date')
train_df = df[df['p_id'] != subject]
n = len(test_subject_df)
if n < 3:
continue
from sklearn.metrics import accuracy_score
from sklearn.metrics import cohen_kappa_score
from sklearn.metrics import precision_recall_fscore_support
def validation_prediction(dataloader,model,loss_fn):
model.eval()
total = 0
correct = 0
running_loss = 0
actual_label_list = []
import math
from functools import reduce
def primeFactor(num):
pFactorList = []
factor = 2
while factor <= math.sqrt(num):
import math
from functools import reduce
def primeFactor(num):
pFactorList = []
factor = 2
while factor <= math.sqrt(num):
import math
from functools import reduce
def primeFactor(num):
pFactorList = []
factor = 2
while factor <= math.sqrt(num):
def maxF(L):
maxlength = 0
for k, v in L.items():
l = len(v)
if l > maxlength:
maxlength = l
return maxlength
a = [1546, 89, 989, 1131, 289, 565, 10, 2, 54791]
L = {i:str(a[i]) for i in range(len(a))}
def maxF(L):
maxlength = 0
for k, v in L.items():
l = len(v)
if l > maxlength:
maxlength = l
return maxlength
a = [1546, 89, 989, 1131, 289, 565, 10, 2]
L = {i:str(a[i]) for i in range(len(a))}
CS50::query("INSERT INTO places (country_code, postal_code, place_name, admin_name1, admin_code1, admin_name2, admin_code2, admin_name3, admin_code3, latitude, longitude, accuracy) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", $data[0],$data[1],$data[2],$data[3],$data[4],$data[5],$data[6],$data[7],$data[8],$data[9],$data[10],$data[11]);
import { Component } from '@angular/core';
export class Hero {
id: number;
name: string;
}
@Component({
template:`
<h1>{{title}}</h1>