This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // www.abukhleif.com | |
| void multiplyAndDivide (int x, int y, int& mul, double& div) { | |
| mul = x * y; | |
| div = (x * 1.0) / y; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // www.abukhleif.com | |
| #include <iostream> | |
| using namespace std; | |
| void multiplyAndDivide (int x, int y, int& mul, double& div) { | |
| mul = x * y; | |
| div = (x * 1.0) / y; | |
| } | |
| int main() { | |
| int n1, n2, m; | |
| double d; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| case "${1:-''}" in | |
| 'start') | |
| if test -f /tmp/selenium.pid | |
| then | |
| echo "Selenium is already running." | |
| else | |
| export DISPLAY=localhost:99.0 | |
| java -Dwebdriver.gecko.driver="/usr/lib/geckodriver/geckodriver" -jar /usr/lib/selenium/selenium-server-standalone.jar -port 4444 > /var/log/selenium/output.log 2> /var/log/selenium/error.log & echo $! > /tmp/selenium.pid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "capabilities": | |
| [ | |
| { | |
| "browserName": "firefox", | |
| "maxInstances": 10 | |
| } | |
| ], | |
| "port":5555, | |
| "hubPort":4444, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 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) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## 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 |