1 2 3 4 5 |
cat /proc/cpuinfo //informacje o procesorze oraz lscpu cat /proc/meminfo //pamięć lspci -tv //urządzenia pci lsusb -tv //urządzenia usb uname -m //architektura |
1 2 3 4 5 |
cat /proc/cpuinfo //informacje o procesorze oraz lscpu cat /proc/meminfo //pamięć lspci -tv //urządzenia pci lsusb -tv //urządzenia usb uname -m //architektura |
1 2 3 4 5 |
xrandr //wyświetla dostępne xrandr -s 1440x900 //ustawia wybraną hwinfo --framebuffer | grep "Mode" //wyświetla dostępne (lepiej działa) sudo apt install hwinfo //instalacja |
1 |
watch -n.1 "cat /proc/cpuinfo | grep \"^[c]pu MHz\"" |
1 |
nmcli dev wifi connect YourWifi password YourPassword |
1 2 |
sudo add-apt-repository ppa:graphics-drivers/ppa sudo apt-get update |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
package com.company; import java.util.*; import java.util.stream.Collectors; public class Person { private final String name; private final int age; private Gender gender; public enum Gender { MALE, FEMALE } public Person(String name, int age, Gender gender) { this.name = name; this.age = age; this.gender = gender; } public String getName() { return name; } public int getAge() { return age; } public Gender getGender() { return gender; } @Override public String toString() { return "Person{" + "name='" + name + '\'' + ", age=" + age + ", gender=" + gender + '}'; } public static void main(String[] args) { List<Person> people = getPeople(); List<Person> females = people.stream() //tylko FEMALE .filter(person -> person.gender.equals(Gender.FEMALE)) .collect(Collectors.toList()); females.forEach(System.out::println); List<Person> sorted = people.stream() //posortowane wg wieku .sorted(Comparator.comparing(Person::getAge)) //po dodaniu .reversed()) odwróci listę .collect(Collectors.toList()); sorted.forEach(System.out::println); boolean allMatch = people.stream() //czy wszyscy z listy spełniają warunek wiek >=28 .allMatch(person -> person.getAge()>=28); System.out.println(allMatch); boolean anyMatch = people.stream() //czy ktokolwiek spełnia warunek wiek >=20 .anyMatch(person -> person.getAge()==20); System.out.println(anyMatch); boolean noneMatch = people.stream() //czy nikt nie spełnia warunku name.equals("Harry Poter") .noneMatch(person -> person.getName().equals("Harry Poter")); System.out.println(noneMatch); people.stream() //osoba o największym wieku .max(Comparator.comparing(Person::getAge)) .ifPresent(System.out::println); people.stream() //osoba o najmniejszym wieku .min(Comparator.comparing(Person::getAge)) .ifPresent(System.out::println); } private static List<Person> getPeople() { return Arrays.asList( new Person("James Bond", 20, Gender.MALE), new Person("Alina Smith", 33, Gender.FEMALE), new Person("Helen White", 28, Gender.FEMALE), new Person("Alan Black", 19, Gender.MALE) ); } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
public class Osoba { public String imie; public int id; public static int count = 1; public Osoba(String imie) { this.imie = imie; id = count; count++; } public static void main(String[] args) { Osoba o1 = new Osoba("Piotr"); Osoba o2 = new Osoba("Pawel"); Osoba o3 = new Osoba("Ola"); System.out.println("Osoba " + o1.imie + " ma numer: " + o1.id); System.out.println("Osoba " + o2.imie + " ma numer: " + o2.id); System.out.println("Osoba " + o3.imie + " ma numer: " + o3.id); } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
loop1: for (int i = 0; i < 6; i++) { for (int j = 0; j < 10; j++) { System.out.println(i + " " + j); if (j == 4) { break loop1; } } } // output: // 00 // 01 // 02 // 03 // 04 |
1 2 3 4 5 6 7 8 9 10 11 12 |
// W pliku /etc/X11/xorg.conf (jako root user) dodajemy na końcu: Section "Screen" Identifier "Screen0" Device "Device0" Monitor "Monitor0" DefaultDepth 24 SubSection "Display" Depth 24 EndSubSection Option "RegistryDwords" "EnableBrightnessControl=1" EndSection |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import java.math.BigDecimal; public class AccountWithBigDecimal { public static void main(String[] args) { BigDecimal accountBalance = new BigDecimal("0.0"); BigDecimal point = new BigDecimal("0.01"); for (int i = 0; i < 100; i++) { accountBalance = accountBalance.add(point); } System.out.println("Po dodaniu 100 groszy do konta na koncie jest " + accountBalance + " zł"); } } |