Skip to content

Instantly share code, notes, and snippets.

View mohnoor94's full-sized avatar
📘
Always Learning...

Mohammad Noor Abu Khleif mohnoor94

📘
Always Learning...
View GitHub Profile
@mohnoor94
mohnoor94 / git_uncommit.sh
Created December 7, 2020 11:17
git uncommit && git cancel_uncommit commands!
git-uncommit () {
if [[ $# -eq 0 ]]
then
echo '!! Please enter the number of commits you want to undo!'
else
git reset --soft HEAD~$1
echo ">> Magic done: $1 commit(s) rolled back!"
fi
} # Undo (Soft reset) last N commits!
@mohnoor94
mohnoor94 / git-clearHistory
Created April 18, 2020 18:42 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin [email protected]:<YOUR ACCOUNT>/<YOUR REPOS>.git
@mohnoor94
mohnoor94 / interviewitems.MD
Created July 17, 2019 23:23 — forked from amaxwell01/interviewitems.MD
My answers to over 100 Google interview questions

##Google Interview Questions: Product Marketing Manager

  • Why do you want to join Google? -- Because I want to create tools for others to learn, for free. I didn't have a lot of money when growing up so I didn't get access to the same books, computers and resources that others had which caused money, I want to help ensure that others can learn on the same playing field regardless of their families wealth status or location.
  • What do you know about Google’s product and technology? -- A lot actually, I am a beta tester for numerous products, I use most of the Google tools such as: Search, Gmaill, Drive, Reader, Calendar, G+, YouTube, Web Master Tools, Keyword tools, Analytics etc.
  • If you are Product Manager for Google’s Adwords, how do you plan to market this?
  • What would you say during an AdWords or AdSense product seminar?
  • Who are Google’s competitors, and how does Google compete with them? -- Google competes on numerous fields: --- Search: Baidu, Bing, Duck Duck Go
@mohnoor94
mohnoor94 / interviewitems.MD
Created July 17, 2019 23:22 — forked from rmax/interviewitems.MD
My answers to over 100 Google interview questions

##Google Interview Questions: Product Marketing Manager

  • Why do you want to join Google?

  • What do you know about Google’s product and technology?

  • If you are Product Manager for Google’s Adwords, how do you plan to market this?

  • What would you say during an AdWords or AdSense product seminar?

  • Who are Google’s competitors, and how does Google compete with them?

  • Have you ever used Google’s products? Gmail?

  • What’s a creative way of marketing Google’s brand name and product?

  • If you are the product marketing manager for Google’s Gmail product, how do you plan to market it so as to achieve 100 million customers in 6 months?

@mohnoor94
mohnoor94 / installScala.txt
Last active August 28, 2023 14:58 — forked from Frozenfire92/gist:3627e38dc47ca581d6d024c14c1cf4a9
Install Scala and SBT using apt on Ubuntu or any Debian derivative using apt
## Java
sudo apt update
sudo apt install default-jdk
## Scala
sudo apt remove scala-library scala
sudo wget http://scala-lang.org/files/archive/scala-2.12.6.deb
sudo dpkg -i scala-2.12.6.deb
## SBT
@mohnoor94
mohnoor94 / evenOddSum.cpp
Created March 17, 2018 18:10
Write a C++ program that reads a set of integers then finds and prints the sum of even and odd integers.
#include <iostream>
using namespace std;
int main () {
int n, x, oddSum = 0, evenSum = 0;
cout << "Enter the number of values: ";
cin >> n;
cout << "Enter your values:" << endl;
for (int i = 0; i < n; i++) {
cin >> x;
@mohnoor94
mohnoor94 / CountingChange.sc
Created March 3, 2018 22:13
Functional Programming Principles in Scala - Exercise 3: Counting Change
/**
* Exercise 3
*/
def countChange(money: Int, coins: List[Int]): Int = {
if (money == 0) 1
else if (money < 0 || coins.isEmpty) 0
else countChange(money - coins.head, coins) + countChange(money, coins.tail)
}
@mohnoor94
mohnoor94 / ParenthesesBalancing.sc
Created March 3, 2018 21:58
Functional Programming Principles in Scala - Exercise 2: Parentheses Balancing
/**
* Exercise 2
*/
def balance(chars: List[Char]): Boolean = {
def difference(acc: Int, ch: List[Char]): Int = {
val head = ch.head
val tail = ch.tail
val isLeft = head == '('
val isRight = head == ')'
val notEmptyTail = tail.nonEmpty
@mohnoor94
mohnoor94 / PascalTriangle.sc
Last active March 3, 2018 21:58
Functional Programming Principles in Scala - Exercise 1: Pascal’s Triangle
object Main {
def main(args: Array[String]) {
println("Pascal's Triangle")
for (row <- 0 to 10) {
for (col <- 0 to row)
print(pascal(col, row) + " ")
println()
}
}
@mohnoor94
mohnoor94 / Java Calculator Using Reflection.java
Created December 30, 2017 17:36
A simple Java calculator supports four operations (Summation, Subtraction, Multiplying, and Division) without using if or switch statements. (Using Reflection)
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Scanner;
public class MainClass {
public static void main(String[] args) throws ClassNotFoundException, InvocationTargetException, IllegalAccessException, NoSuchMethodException {
Scanner scanner = new Scanner(System.in);
Class<?> operations = Class.forName("MainClass");
MainClass mainClass = new MainClass();
Method method = operations.getDeclaredMethod(scanner.next(), double.class, double.class);