Skip to content

Instantly share code, notes, and snippets.

View pavly-gerges's full-sized avatar
🤖
Electrostat Lab.

Pavly Gerges (pavl_g) pavly-gerges

🤖
Electrostat Lab.
View GitHub Profile
@pavly-gerges
pavly-gerges / passing_params.c
Created January 26, 2023 22:09
Pass by reference V.S. Pass by address
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
static inline void printAddress(void** ptr_address) {
printf("%p\n", *ptr_address);
}
static inline void destroy(void** ptr_address) {
free(*ptr_address);
@pavly-gerges
pavly-gerges / realloc_example.c
Last active January 26, 2023 21:37
An example showing GNU `realloc`
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
int main() {
// allocating memory for 6 integers (total = 6 * 4 = 24 bytes)
int* ptr = malloc(6 * sizeof(int));
for (int i = 0; i < 6; i++) { /* 6 * 4 = 24 bytes = 24 * 8 = 192 bits */
@pavly-gerges
pavly-gerges / fastboot_help.md
Created January 25, 2023 21:42 — forked from MrHallows/fastboot_help.md
fastboot commands

Command:

$ fastboot help

Output:

usage: fastboot [OPTION...] COMMAND...

flashing:
@pavly-gerges
pavly-gerges / techdemo.c
Last active January 6, 2023 10:49
Test Deep copy V.S. Superficial copy
// Online C compiler to run C program online
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
typedef struct {
int baud;
uint8_t data;
} uart;
@pavly-gerges
pavly-gerges / HelloDynmaicArray.c
Created October 29, 2022 14:23
An example of dynamic arrays in C
/**
* @brief: Shows a minimalistic example of dynamic arrays.
*
* @author pavl_g.
*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct {
@pavly-gerges
pavly-gerges / dropdown.md
Last active December 9, 2022 11:08 — forked from citrusui/dropdown.md
"Dropdowns" in Markdown
How do I dropdown?
This is how you dropdown.

<details>
<summary>How do I dropdown?</summary>
<br>
This is how you dropdown.
@pavly-gerges
pavly-gerges / sources.list
Created September 16, 2022 18:53 — forked from h0bbel/sources.list
/etc/apt/sources.list for Ubuntu 18.04.1 LTS Bionic Beaver
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
/*
| Example part of AVR Tutorial Series @ Explore Embedded
| To read the detailed tutorial visit:
| http://exploreembedded.com/wiki/5.AVR_Timer_programming
*/
#include<avr/io.h>
#include <util/delay.h>
#define LED PD4
int main()
{
#include<avr/io.h>
#include<avr/interrupt.h>
#include<util/delay.h>
#include "lcd.h"
volatile int cnt_zero,cnt_one;
ISR (INT0_vect) //External interrupt_zero ISR
{
cnt_zero++;
}
ISR (INT1_vect) //External interrupt_one ISR