Skip to content

Instantly share code, notes, and snippets.

View omsharp's full-sized avatar

Omar Rwemi omsharp

View GitHub Profile
@omsharp
omsharp / prayer_times_tripoli_ly.json
Last active May 20, 2023 00:53
Islamic Prayer times for the whole year, based on the local time of Tripoli-Libya
[{
"Day": 1,
"Month": 1,
"Fajr": 399,
"Sunrise": 489,
"Duhr": 794,
"Asr": 952,
"Maghrib": 1095,
"Isha": 1181
},
@omsharp
omsharp / task.json
Created February 24, 2024 13:27
Build task for CMake Tools on VSCode
{
"version": "2.0.0",
"tasks": [
{
"type": "cmake",
"label": "CMake_build",
"command": "build",
"targets": [
"ALL_BUILD"
],
@omsharp
omsharp / launch.json
Created February 24, 2024 13:31
VSCode launch file for gcc. with two configs: one for build/run without debug, and the other for build/debug with gdb.
{
"configurations": [
{
"name": "Build/Run without debugging",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build/main.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
@omsharp
omsharp / CMakeLists.txt
Created February 26, 2024 22:35
CMake file for simple C project
cmake_minimum_required(VERSION 3.28)
set(CMAKE_C_STANDARD 23)
set(SRC ${CMAKE_CURRENT_LIST_DIR}/src)
add_executable(program
SRC/main.c
SRC/calculator.c)
@omsharp
omsharp / print-bits.c
Last active April 11, 2024 10:44
C function to print binary representation of a value
void PrintBits(void *valuePtr, size_t sizeInBytes) {
// loopup table for bit values
uint8_t bitsLookup[8] = {1, 2, 4, 8, 16, 32, 64, 128};
// loop over each byte
for (int8_t i = sizeInBytes - 1; i >= 0; i--) {
// get a pointer to the current byte and dereference it
uint8_t byte = ((uint8_t *)valuePtr)[i];
// loop over each value in bits lookup table
// and check if the bit is 1 or 0 using betweise or with the bit binary value
for (int8_t j = 7; j >= 0; j--) {
@omsharp
omsharp / Stop git asking for passphrase.txt
Last active July 7, 2024 10:14
How to make git ssh not ask for passphrase
At Terminal enter: ssh-keygen -p
Enter the private key file path: ex (~/.ssh/id_23444)
Enter the old passphrase
Press enter
Done