Skip to content

Instantly share code, notes, and snippets.

View alsamitech's full-sized avatar

Sami Alameddine alsamitech

  • Alsami Technologies
  • United States of America
View GitHub Profile
@alsamitech
alsamitech / CopilotTorturePrompt.md
Created July 1, 2025 09:33
Claude excels, Gemini tries, GPT fails :(

Implement the following program completley and comprehensively. Meet or exceed the requiremenents. You may want to seperate the implementation into many files.

Overview

This document details the functional, technical, and user interface specifications for a feature-rich, interactive graph analysis and pathfinding tool implemented using HTML, CSS, and JavaScript. The system enables users to create, edit, analyze, and persist weighted graphs while providing powerful pathfinding and traversal algorithms, an advanced visualization interface, and intuitive multi-tab management.

Features Summary

Graph Interaction & Editing

// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package team696.frc.robot.commands;
import team696.frc.lib.Camera.BaseCam.AprilTagResult;
import team696.frc.robot.Constants;
import team696.frc.robot.subsystems.Swerve;
@alsamitech
alsamitech / rf.c
Created September 18, 2024 18:02
Reverse Factorial
long unsigned int rf(long unsigned int rf){
long unsigned int d=1;
while(rf!=1)rf/=d++;
return d-1;
}
@alsamitech
alsamitech / longpow.c
Created September 1, 2021 20:37
longpow - exponent function in 3 lines
long longpow(const long val, long pw){
long res=val;
while(--pw)res*=val;
return res;
}
@alsamitech
alsamitech / starts_with_5.c
Created August 27, 2021 20:52
the fifth iteration of starts_with
_Bool starts_with(const char* restrict str, const char* restrict sw){
while(*sw)
if(*sw++!=*str++)return 0;
return 1;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stddef.h>
#include <memory.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
void reverse_bytes(char* restrict bytes, const size_t len){
for(size_t i=0;i<len/2;i++){
char tmp=bytes[i];
bytes[i]=bytes[len-1-i];
bytes[len-1-i]=tmp;
}
}
// str must have 11 bytes allocated to it
void int_to_str(int val, char* str){
void str_clear(char* restrict str){
while(*str)*str++=0;
}
void str_set(char* restrict str, const char set){
while(*str)*str++=set;
}
@alsamitech
alsamitech / file_count.c
Created August 7, 2021 07:11
file_count- lists the amount of files in a directory
// file_count will add one to the count because zero is reserved for errors
size_t file_count(const char* dir_nm){
DIR* dir=opendir(dir_nm);
if(!dir)return 0;
struct dirent* entity=readdir(dir);
size_t count=0;
for(;readdir(dir);count++);
closedir(dir);
return count;
}
@alsamitech
alsamitech / strcmp_until.c
Created July 27, 2021 04:30
strcmp_until - faster than doing strncmp with passing until_char
_Bool strcmp_until(const char* s1,const char* s2,const char until){
for(size_t i=0;s1[i]!=until;i++)
if(s1[i]!=s2[i])return 1;
return 0;
}