Skip to content

Instantly share code, notes, and snippets.

View yahyatawil's full-sized avatar

yahya tawil yahyatawil

View GitHub Profile
@yahyatawil
yahyatawil / easiest-way-to-calculate-function-size-in-c.md
Last active March 17, 2019 19:27
The Easiest Way to Calculate Function Size in C

Unfortunately calculating function size is not as easy of finding variable size using sizeof() compile-time operator. There are numerous ways to calculate the size in run-time but to keep things simple, it’s better to check that information from linker, as for sure must knows it.

Let’s talk about what things we are going to use:

1- “.map” file generated by GCC/G++ linker:

This file has the symbols we have in the code/firmware either in flash, RAM or any other defined memory section. The following snippet is taken from compiling one of the examples of nRF52 SDK. If you want to try just run make default inside the following directory examples\peripheral\gpiote\pca10040\blank\armgcc. The first column is the symbol start address, the second column is the function size in HEX and the third one is the object file name containing that symbol.

.text.bsp_board_led_invert
Item # Designator Qty Manufacturer Mfg Part # Description / Value Package/Footprint Type Your Instructions / Notes
1 C1, C2, C4, C5, C6, C7 6 KEMET C0603C104K5RAC3121 CAP 100NF 50V 0603 SMD
2 C3, C8 2 Taiyo Yuden TMK107BLD105KA-T CAP 1UF 25V 0603 SMD
3 C9, C11 2 KEMET C0603C220J5GAC3190 CAP 22PF 50V 0603 SMD
4 PC1, PC2 2 Panasonic
@yahyatawil
yahyatawil / Hack.md
Last active August 24, 2020 00:53
Creat a Desktop Application for Any Website

How to use Nativefier to create an desktop app

  1. Download Node.js®. This is required for Nativefier to work.

  2. Open the Node.js command prompt and install Nativefier. Copy & paste the following to install and press enter:

npm install nativefier -g

  1. Create wrapper for Asana web app. Once Nativefier is installed, copy & paste the following into the Node.js command prompt and press enter:

iteration with index and members:

for i, member in enumerate(array):

slicing (RGB example)

Img_array[x:x+w,y:y+h,:]

show more than one image in opencv2 imshow

temp_img1 = cv2.hconcat([cell1,neighbour_cells[0]])

Preserve variable value between software resets resets

in 'MEMORY' section:

MEMORY { ROMEM (rx) : ORIGIN = 0x0000C000, LENGTH = 976K RWMEM (rwx) : ORIGIN = 0x10000000, LENGTH = 383K NOINIT (rwx) :ORIGIN = 0x1005FC00, LENGTH = 1k }

# adapted and modified:
# https://gist.github.com/kodekracker/1777f35e8462b2b21846c14c0677f611
import cv2
import sys
import os
import xml.etree.ElementTree as ET
imagePath = "C:/Users/DELL/Desktop/samples/bbox/MP_SEL_B027484.jpg"