Skip to content

Instantly share code, notes, and snippets.

View imedadel's full-sized avatar
🏗️
Building something

Imed Adel imedadel

🏗️
Building something
View GitHub Profile
[alias]
puch = "!f() { \
printf [$1]'\n' && git push $1 $3 && printf '\n'[$2]'\n' && git push $2 $3; \
}; f"
document.querySelectorAll('.commits-row a.commit-row-message').forEach(x => console.log(x.textContent,":\n",x.href))
@imedadel
imedadel / push_to_all_repos.sh
Created September 5, 2019 16:06
A bash script to push all git repositories to all git remotes
for i in `ls`; do echo "--- Pushing $i"; cd $i; for j in `git remote`; do git push $j master; echo "pushed to $j"; done; cd ..; echo "--- Finished $i"; done;
/* Multi color */
* { background-color: rgba(255,0,0,.2); }
* * { background-color: rgba(0,255,0,.2); }
* * * { background-color: rgba(0,0,255,.2); }
* * * * { background-color: rgba(255,0,255,.2); }
* * * * * { background-color: rgba(0,255,255,.2); }
* * * * * * { background-color: rgba(255,255,0,.2); }
* * * * * * * { background-color: rgba(255,0,0,.2); }
* * * * * * * * { background-color: rgba(0,255,0,.2); }
* * * * * * * * * { background-color: rgba(0,0,255,.2); }
// Using class name
[...document.querySelectorAll('img.FFVAD')]
// Using alt text
[...document.querySelectorAll('img')].filter(img => img.alt.includes('Image may contain') || img.alt.includes.('No photo description available.'))
auto _=[](){ios::sync_with_stdio(0);cin.tie(0);return cout.tie(0);}();
public static int diagonalDifference(List<List<Integer>> arr) {
// Write your code here
int n = arr.size();
int dP = 0;
int dS = 0;
for(int i = 0; i < n; ++i) {
int pos = (i*(n+1))%n;
dP += arr.get(i).get(pos);
dS += arr.get(i).get(n-1-pos);
}
def diagonalDifference(arr):
# Write your code here
n = len(arr)
dP = 0
dS = 0
for i in range(n):
pos = (i*(n+1))%n
dP += arr[i][pos]
dS += arr[i][n-1-pos]
return abs(dP - dS)
def plusMinus(arr):
#
# Write your code here.
#
n = len(arr)
pos = 0
neg = 0
nada = 0
for x in arr:
if x > 0:
static void plusMinus(int[] arr) {
int n = arr.length;
float pos = 0;
float neg = 0;
float nada = 0;
for (int x : arr) {
if (x>0) ++pos;
else if (x<0) ++neg;
else ++nada;
}