Skip to content

Instantly share code, notes, and snippets.

View ahmedfgad's full-sized avatar

Ahmed Gad ahmedfgad

View GitHub Profile
@deekayen
deekayen / 1-1000.txt
Last active November 13, 2025 15:53
1,000 most common US English words
the
of
to
and
a
in
is
it
you
that
@arne-cl
arne-cl / restore_packages.R
Created September 16, 2014 08:46
save/load/install a list of your currently installed R packages
# restore_packages.R
#
# installs each package from the stored list of packages
# source: http://hlplab.wordpress.com/2012/06/01/transferring-installed-packages-between-different-installations-of-r/
load("~/installed_packages.rda")
for (count in 1:length(installedpackages)) {
install.packages(installedpackages[count])
}
import numpy
import GA
"""
The y=target is to maximize this equation ASAP:
@meyerjo
meyerjo / iou.py
Last active July 17, 2024 18:01
Python code to compute the intersection of two boundingboxes
def bb_intersection_over_union(boxA, boxB):
# determine the (x, y)-coordinates of the intersection rectangle
xA = max(boxA[0], boxB[0])
yA = max(boxA[1], boxB[1])
xB = min(boxA[2], boxB[2])
yB = min(boxA[3], boxB[3])
# compute the area of intersection rectangle
interArea = abs(max((xB - xA, 0)) * max((yB - yA), 0))
if interArea == 0:
@ShyamaSankar
ShyamaSankar / list_comprehension_with_if_elif_else_ladder.py
Created March 17, 2019 06:06
List comprehension with an if-elif-else ladder
# Original list of numbers.
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
# For loop to create a new list where we substitute all multiples of 2 by 0,
# multiples of 3(which are not multiples of 2) by 1 and leave the rest as it is.
modified_numbers = []
for number in numbers:
if number % 2 == 0:
modified_numbers.append(0)
elif number % 3 == 0: