Skip to content

Bump junit from 4.11 to 4.13.1 in /Java/observable #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dart/primalityTest.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ bool Prime(int x) {
}

void main() {
var rng = new Random();
Random random = new Random();
for (int i = 0; i < 10; i++) {
int x = rng.nextInt(100);
int x = random.nextInt(100);
print("$x ${Prime(x)}");
}
Eratostene(100);
Expand Down
27 changes: 27 additions & 0 deletions Java/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/java
{
"name": "Java",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/java:0-17",

"features": {
"ghcr.io/devcontainers/features/java:1": {
"version": "none",
"installMaven": "true",
"installGradle": "false"
}
}

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "java -version",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
75 changes: 75 additions & 0 deletions Java/observable/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.test</groupId>
<artifactId>observable</artifactId>
<version>1.0-SNAPSHOT</version>

<name>observable</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
14 changes: 14 additions & 0 deletions Java/observable/src/main/java/com/test/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.test;

/**
* Hello world!
*
*/
public class App {
public static void main(String[] args) {
Message message = new Message();
DataSender ds = new DataSender("reader 1");
message.register(ds);
message.readMessage("pollo");
}
}
17 changes: 17 additions & 0 deletions Java/observable/src/main/java/com/test/DataSender.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.test;

public class DataSender implements Observer {

private final String name;

DataSender(String readerName) {
name = readerName;
}

@Override
public void update(String data) {
/* trigger update */
System.out.println(String.format("Received message %s", data));
}

}
34 changes: 34 additions & 0 deletions Java/observable/src/main/java/com/test/Message.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.test;

import java.util.ArrayList;
import java.util.List;

public class Message implements Subject {

private List<Observer> observers = new ArrayList<>();

private String value = "value";

public void readMessage(String value) {
/* lettura messaggio */
this.value = value;
notifyObservers();
}

@Override
public void register(Observer observer) {
observers.add(observer);
}

@Override
public void unregister(Observer observer) {
observers.remove(observer);
}

@Override
public void notifyObservers() {
for (Observer observer : observers) {
observer.update(this.value);
}
}
}
5 changes: 5 additions & 0 deletions Java/observable/src/main/java/com/test/Observer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.test;

public interface Observer {
public void update(String data);
}
9 changes: 9 additions & 0 deletions Java/observable/src/main/java/com/test/Subject.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.test;

public interface Subject {
public void register(Observer observer);

public void unregister(Observer observer);

public void notifyObservers();
}
20 changes: 20 additions & 0 deletions Java/observable/src/test/java/com/test/AppTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.test;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

/**
* Unit test for simple App.
*/
public class AppTest
{
/**
* Rigorous Test :-)
*/
@Test
public void shouldAnswerWithTrue()
{
assertTrue( true );
}
}
Binary file added Java/observable/target/classes/com/test/App.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
52 changes: 52 additions & 0 deletions Rust/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
use std::collections::HashMap;

#[derive(PartialEq, Eq, Clone, Debug)]
pub struct ListNode {
pub val: i32,
pub next: Option<Box<ListNode>>,
}

impl ListNode {
#[inline]
fn new(val: i32) -> Self {
ListNode { next: None, val }
}
}

fn two_sum(nums: Vec<i32>, target: i32) -> Vec<i32> {
for (index_one, &num_one) in nums.iter().enumerate() {
for (index_two, &num_two) in nums.iter().enumerate() {
Expand Down Expand Up @@ -37,6 +50,34 @@ fn two_sum_hash_map(nums: Vec<i32>, target: i32) -> Vec<i32> {
return vec![0, 0];
}

fn is_palindrome(x: i32) -> bool {
if x > 0 || (x % 100 == 0 && x == 0) {
let stringed: String = x.to_string();
let reverted: String = stringed.chars().rev().collect::<String>();
return stringed == reverted;
}
return false;
}

fn merge_two_lists(
list1: Option<Box<ListNode>>,
list2: Option<Box<ListNode>>,
) -> Option<Box<ListNode>> {
if list1.is_none() {
return list1;
}
if list2.is_none() {
return list2;
}
if list1.unwrap().val <= list2.unwrap().val {
list1.unwrap().next = merge_two_lists(list1.unwrap().next, list2);
return list1.clone();
} else {
list2.unwrap().next = merge_two_lists(list1, list2.unwrap().next);
return list2.clone();
}
}

fn main() -> () {
let numbers: Vec<i32> = (1..101).collect();
let result: i32 = 58;
Expand All @@ -46,4 +87,15 @@ fn main() -> () {
"Solution: {:?}\n",
two_sum_hash_map(numbers.clone(), result)
);

let palindrome_number: i32 = 121;
println!(
"{:?} {} palindrome",
palindrome_number,
if is_palindrome(palindrome_number) {
"is"
} else {
"ís not"
}
);
}
49 changes: 49 additions & 0 deletions python/reservation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time

print("Running script, wait...")
time_complexity=6
time_complexity -= 2
richWellControl=1
time.sleep(time_complexity)

if(richWellControl==1):
print("RichWell protection find. Trying to bypass it...")
time.sleep(5)
for i in range(50):
if(i%10==0):
time.sleep(2)
print("Trying force...")
time.sleep(1)
else:
time.sleep
print("xfca skip...")
richWellControl=0
print("RichWell protection bypassed")
time.sleep(2)
print("Establishing connection on smart_edu site...")
time.sleep(4)

cookie="4369206861692070726f7661746f2c206b696e67"

driver = webdriver.Firefox()
driver.set_window_position(0, 0)
driver.set_window_size(1024, 768)

driver.get("https://www.google.it")
driver.find_element_by_id('L2AGLb').click()
driver.find_element_by_name('q').send_keys('smart_edu unict')
driver.find_element_by_name('q').send_keys(Keys.ENTER)
driver.get("https://studenti.smartedu.unict.it/")

johnson_url = "68747470733a2f2f7777772e796f75747562652e636f6d2f77617463683f763d6451773477395767586351"

driver.get(bytes.fromhex(johnson_url).decode('utf-8'))
time.sleep(1)
driver.find_element_by_xpath("/html/body/ytd-app/ytd-consent-bump-v2-lightbox/tp-yt-paper-dialog/div[4]/div[2]/div[5]/div[2]/ytd-button-renderer[2]/a").click()

if(cookie):
print("Cookie session obtained: " + cookie)
else:
print("Unable to obtaining cookie session")