2020. november 18., szerda

Linux Flatpak szoftver régi verzió telepítése (Zoom példa)

Zoom telepítése

flatpak install flathub us.zoom.Zoom


Régi verziók listája

flatpak remote-info --log flathub us.zoom.Zoom


...

          Kommit: fcd07f9b9db535f1e753bb193ca1f306619e6c7b4076359445eae3a8d70c52da

           Tárgy: Update zoom.tar.xz to 5.3.472687.1012 (66c7d92d)

           Dátum: 2020-10-12 11:33:50 +0000

...


Egy konkrét régi verzió telepítése

sudo flatpak update --commit=fcd07f9b9db535f1e753bb193ca1f306619e6c7b4076359445eae3a8d70c52da us.zoom.Zoom


Automatikus frissítések letiltása

sudo flatpak mask us.zoom.Zoom

2020. november 8., vasárnap

COVID statisztika letöltése és táblázatba exportálás Python szkript - covid2xls.py

Előkövetelmények:
  • Python 3
  • Két python könyvtár telepítése
    • pip3 install pandas 
    • pip3 install xlwt
 
Futtatás: python3 covid2xls.py

Kód:
 
import requests
import bs4
from bs4 import BeautifulSoup
import pandas as pd

#######################xlwt###########################

import xlwt
from xlwt import Workbook

wb = Workbook()

sheet1 = wb.add_sheet('Sheet 1')
sheet1.write(0, 0, 'Sorszám ')
sheet1.write(0, 1 ,'Nem')
sheet1.write(0, 2 ,'Kor')
sheet1.write(0, 3 ,'Alapbetegségek')

count=0

#######################xlwt###########################

for i in range(0,40):
    

    user_agent = 'Chrome/80.0.3987.132 Mozilla/5.0'
    response = requests.get(f"https://koronavirus.gov.hu/elhunytak?page={i}", stream=True,headers={'User-Agent': user_agent})

    soup = BeautifulSoup(response.text, 'html.parser')

    tables = soup.find_all('table')

    df = pd.read_html(str(tables))[0]

    print(df)

    for i in range(0,len(df["Sorszám"])):
        count=count+1
        sheet1.write(count, 0, str(df["Sorszám"][i]))
        sheet1.write(count, 1 ,str(df["Nem"][i]))
        sheet1.write(count, 2 ,int( df["Kor"][i]))
        sheet1.write(count, 3 ,str(df["Alapbetegségek"][i]))
        wb.save("out.xls")

2020. október 14., szerda

GNU Linux Mint 20 LTS szoftverek telepítése

sudo apt-get install -y vlc nautilus-image-converter audacity picard gimp krita p7zip bleachbit meld filezilla k3b

# OBS Studio - videók streamelése, képernyőfelvétel
sudo apt install ffmpeg
sudo add-apt-repository ppa:obsproject/obs-studio
sudo apt install -y obs-studio

# LibreOffice 7 irodai programcsomag
sudo add-apt-repository ppa:libreoffice/libreoffice-7-0
sudo apt install -y libreoffice 

sudo apt purge libreoffice-l10n-es libreoffice-l10n-pt libreoffice-l10n-zh-cn libreoffice-l10n-pt-br libreoffice-l10n-de libreoffice-l10n-ru libreoffice-l10n-zh-tw libreoffice-l10n-en-za libreoffice-l10n-it

# NFS meghajtók csatolásához

sudo apt install -y nfs-common


# --------------------------------------------------------

cd
cd Letöltések
cd Downloads

# --------------------------------------------------------

# Google szolgáltatások nélküli sima Chromium böngésző
# https://github.com/ungoogled-software/ungoogled-chromium-debian

echo 'deb http://download.opensuse.org/repositories/home:/ungoogled_chromium/Ubuntu_Focal/ /' | sudo tee /etc/apt/sources.list.d/home-ungoogled_chromium.list > /dev/null
curl -s 'https://download.opensuse.org/repositories/home:/ungoogled_chromium/Ubuntu_Focal/Release.key' | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/home-ungoogled_chromium.gpg > /dev/null
sudo apt update
sudo apt install -y ungoogled-chromium

# --------------------------------------------------------

# Google Chrome böngésző
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb

# --------------------------------------------------------

# Zoom videókonferencia
wget https://zoom.us/client/latest/zoom_amd64.deb
sudo dpkg -i zoom_amd64.deb

# Másik verzió kell? https://forraskod.blogspot.com/2020/11/linux-flatpak-szoftver-regi-verzio.html


# --------------------------------------------------------


# Visual Studio Code fejlesztőkörnyezet (IDE)
# https://code.visualstudio.com/docs/?dv=linux64_deb
wget https://go.microsoft.com/fwlink/?LinkID=760868 -O vscode.deb
sudo dpkg -i vscode.deb

# --------------------------------------------------------

# Signal private messenger - titkosított csevegő
# https://www.signal.org/download/

# NOTE: These instructions only work for 64 bit Debian-based
# Linux distributions such as Ubuntu, Mint etc.

# 1. Install our official public software signing key
wget -O- https://updates.signal.org/desktop/apt/keys.asc |\
  sudo apt-key add -

# 2. Add our repository to your list of repositories
echo "deb [arch=amd64] https://updates.signal.org/desktop/apt xenial main" |\
  sudo tee -a /etc/apt/sources.list.d/signal-xenial.list

# 3. Update your package database and install signal
sudo apt update && sudo apt install signal-desktop


# --------------------------------------------------------

# Elements titkosított csoportos csevegő (Slack-hez hasonló)
sudo apt install -y wget apt-transport-https

sudo wget -O /usr/share/keyrings/riot-im-archive-keyring.gpg https://packages.riot.im/debian/riot-im-archive-keyring.gpg

echo "deb [signed-by=/usr/share/keyrings/riot-im-archive-keyring.gpg] https://packages.riot.im/debian/ default main" | sudo tee /etc/apt/sources.list.d/riot-im.list

sudo apt update
sudo apt install element-desktop

# --------------------------------------------------------

# Draw.io diagram rajzoló

# https://github.com/jgraph/drawio-desktop/releases/latest 

# --------------------------------------------------------

# CudaText haladó szövegszerkesztő - 10 GB-os fájlokat is megnyit

# http://www.uvviewsoft.com/cudatext/

# --------------------------------------------------------

Acetoneiso - ISO BIN NRG MDF IMG fájlok megnyitása

sudo apt-get install acetoneiso

# NoiseTorch - Mikrofon zajszűrés (billentyűzet, ventillátor, stb.)

# https://github.com/lawl/NoiseTorch#download--install

cd

wget https://github.com/lawl/NoiseTorch/releases/latest/download/NoiseTorch_x64.tgz

tar -C $HOME -xzf NoiseTorch_x64.tgz

gtk-update-icon-cache

sudo setcap 'CAP_SYS_RESOURCE=+ep' ~/.local/bin/noisetorch

echo "Autostart setup: https://github.com/lawl/NoiseTorch/wiki/Start-automatically-with-Systemd"


 


 

2020. augusztus 18., kedd

Wordpress gyorsítás tapasztalatok - cache, bővítmények .htaccess, PHP

  • Mindennek az alapja egy jó "SSD"-s szerver (tárhely), ami gyors válaszidővel rendelkezik
  • Illetve egy gyors téma, pl. GeneratePress
  • Cache bővítmények: WP Super Cache, Hummingbird
  • Képoptimalizálók: Webp, Hummingbird
  • Képek gyorsítása CDN, pl. Jetpack
  • DDoS védelem, biztonság CDN, pl. Cloudflare
  • Ha a szerver támogatja az LSPHP-t, a .htaccess fájlba beírni:

AddHandler application/x-httpd-lsphp74 .php .php5



És a teszt :)
  • https://developers.google.com/speed/pagespeed/insights/
  • https://web.dev/measure/
  • https://gtmetrix.com/
  • https://www.webpagetest.org/

2020. augusztus 17., hétfő

Monit.php malware eltávolítása

Monit.php reklámvírus (malware)

Hogyan tudod megállapítani, hogy fertőzött vagy-e? 

A [honlap-URL]-t cseréld ki a te honlapod címére (pl. https://sajathonlapom.hu)

[honlap-URL]/wp-admin/options-general.php?page=monit


Automatikus eltávolítás: cPanel cron 

A tárhely cpanel felületén találod meg a "Időzített feladatok(cron)" lehetőséget:




Állítsd be hogy percenként egyszer lefusson:

A YOUR_EMAIL_ADDRESS helyére ha beírod az email címedet, akkor értesítést kapsz ha megtalálta (és letörölte) a monit.php-t a rendszer.

find . -type f -name "monit.php" -exec echo {} \; -exec stat {} \; -exec rm -f {} \; | mailx -E -s "monit.php threat deleted" YOUR_EMAIL_ADDRESS




Másik módszer eltávolításra: Anti-Malware from GOTMLS.NET


Ajánlom a telepítését! Ha tetszett, akkor 29$ adományért cserébe már rendszeres, automatikus frissítéseket is beállíthatod, de az ingyenes változat is remekül használható.


Kézi eltávolítás:

1. Töröljük le a fájlkezelővel plugins/monit.php

Vagy ssh parancssorban: find /var/www/html/ -name monit.php -exec rm -rf {} \;

2. A MySQL adatbázisban található javascript fájlok, melyek a nem kívánt reklámokat megjelenítik:

<script type="text/javascript" src="//ofgogoatan.com/apu.php?zoneid=3280383" async data-cfasync="false"></script>

<script src="https://propu.sh/pfe/current/tag.min.js?z=3280389" data-cfasync="false" async></script>

<script type="text/javascript" src="//inpagepush.com/400/3336702" data-cfasync="false" async="async"></script>

2 JBEBP("<script*.php?zone*</script>") in wp_options:ad_code":167655.1


SQL parancs amit a phpMyadmin felületre be lehet másolni, aztán a megtalált táblákat törölni:

SELECT * FROM `wp_options` WHERE `option_name` IN ( ‘default_mont_options’, ‘ad_code’ , ‘hide_admin’, ‘hide_logged_in’ , ‘display_ad’, ‘search_engines’ , ‘auto_update’, ‘ip_admin’ , ‘cookies_admin’, ‘logged_admin’, ‘log_install’)

Forrás

https://medium.com/@ianarman/monit-php-wordpress-malware-9ffa5c338e9a

https://www.getastra.com/blog/911/fix-monit-php-monetization-hack/

2020. augusztus 8., szombat

Ékezetes honlap regisztrálása

DNI - Erről jó tudni, így kell megadni több helyen is (pl. kiegészítő domain felvételekor)

https://en.wikipedia.org/wiki/Internationalized_domain_name

Ebből: árvíztűrőtükörfúrógép.hu

Ez lesz: xn--rvztrtkrfrgp-bbb7j2b8f0b9d7a21oft.hu

Online átalakító: punycoder.com


Cloudflare átköltöztetés

Add an A, AAAA, or CNAME record for www so that www.DOMAIN_NEVE.hu will resolve.

Add an A, AAAA, or CNAME record for your root domain so that DOMAIN_NEVE.hu will resolve.

Add an MX record for your root domain so that mail can reach @DOMAIN_NEVE.hu addresses.

Some of your DNS only records are exposing IPs that are proxied through Cloudflare. Make sure to proxy all A, AAAA, and CNAME records pointing to proxied records to avoid exposing your origin IP.


DNS gyorsítótár ürítése Ubuntu 18.04+

 sudo systemd-resolve --flush-caches


2020. június 28., vasárnap

ZFS telepítés és 2 lemez tükrözése

sudo apt install zfs-dkms -y
sudo apt install zfs-dkms -y

lsblk --ascii -o NAME,PARTUUID,LABEL,PATH,FSTYPE

sudo zpool create -f -o ashift=12 -m /home VDEV_NAME mirror /dev/disk/by-partuuid/DISK1_partuuid /dev/disk/by-partuuid/DISK2_partuuid

sudo zfs create VDEV_NAME/DATASET_NAME

zpool set cachefile=/etc/zfs/zpool.cache VDEV_NAME
systemctl enable zfs.target

zfs set relatime=on VDEV_NAME
zfs set compression=lz4 VDEV_NAME

sudo zpool status


# https://low-orbit.net/zfs-guide
# https://briankoopman.com/moving/
# https://pthree.org/2012/12/04/zfs-administration-part-i-vdevs/

2020. június 7., vasárnap

Docker telepítés - Fix Docker mess Ubuntu 18.04

sudo apt purge docker.io docker-compose
sudo apt install docker.io docker-compose

docker-compose is already the newest version (1.17.1-2).
docker.io is already the newest version (19.03.6-0ubuntu1~18.04.1).


@whysthatso Just ran into this issue, could you please describe the full solution step by step? Do I need to uninstall docker-compose and stuff and then reinstall docker or what?
as far as i remember:
  • uninstall everything docker-related
  • check if there is /etc/systemd/system/docker.service, delete it
  • install docker-compose
or it could be:
  • uninstall everything docker-related
but yeah, sorry, i realized i should have contextualized my comment a bit better
  • install docker-compose
  • check if there is /etc/systemd/system/docker.service, delete it
try both, can't really mess anything up here


kwmartin commented

Needed all of:
  1. apt-get remove and re-install using curl as Kirill-Babkin suggests (and restart socker to be safe)
  2. add user to docker group using usermod
    sudo usermod -aG docker $USER
    logout and login
  3. undefine DOCKER_HOST (as suggested by rkazak at https://forums.docker.com/t/docker-commands-require-sudo/12987/2) which I had earlier set using >
  4. export DOCKER_HOST=127.0.0.1:2375
    as suggested by jamethy and shin
    This was on an RPi 3B. After all of this, docker is now working. Is there any chance this could be cleaned up so others don't have to go through this painful experience, as it is experiences like this docker is designed to fix? Just a suggestion.
    https://github.com/docker/compose/issues/4181
sudo service docker restart

2020. május 29., péntek

PDF fájl átalakítása Wiki formátumra

sudo apt install pandoc
sudo apt-get install poppler-utils

PDF --> HTML
sudo mkdir kimenet
sudo pdftohtml -s -p -fmt png -nodrm "file.pdf" "file/file.html"

You can type pdftohtml -h to gain a better understanding of available parameters.
I've explained the parameters used here for the sake of understanding the command:
  • -s contains all of the output within one HTML document (excluding the outline.
  • -p attempts to replaces pdf internal linking with html links.
  • -fmt controls the output format of images, with png and jpg being valid options.
  • -nodrm igores download rights management restrictions on the PDF.
  • -i ignores images. I didn't use this, but it felt prudent to mention as in some cases it may massively speed your output format.

Alternatív módszer: Poppler pdftotext

pdftotext -htmlmeta "file.pdf" "file.html"

 Replace "file" with the name of the file you want to parse and with the name of the HTML file you want to write your text output to. 
 The `-htmlmeta` option creates an HTML version of the text in your PDF. (This is much less fancy than the previous command and only puts the text in `pre` tags). You should see an HTML file in your directory which you can open to check the results of. Depending on the formatting of your source PDF file, you may find that Poppler is variable in it's effectiveness. You can try running `pdftotext -h` for information on other command options that may improve or worsen your results. 

Pandoc: HTML --> MediaWiki

 pandoc file.html -f html -t mediawiki -s -o file.txt
  • -f bemeneti formátum
  • -t kimeneti formátum
  • -s Standalone adds a header and footer to the document, rather than producing a document fragment.
  • -o The name of the output file.
Pandoc user guide.
It is possible you may run into an error with Pandoc, presumably caused by your file being too large. I ran into this error and some fixes can be found here.

Opció: rossz kódolás kitakarítása

Depending on your PDF encoding, you may find strange Unicode charecters in your HTML output. This step is intended to clean up this output to the best possible degree of accuracy. ftfy, stands for fixes text for you, and it's a Python library with a command-line interface. We'll be using the command line to clean our files. This step is preformed before using Pandoc.

ftfy telepítése:
git clone https://github.com/LuminosoInsight/python-ftfy.git
cd python-ftfy
sudo python setup.py install
Or, if you system has pip, pip install ftfy. Note that if you want to use a version of 5.0 (most recent available at time of writing) or later, you need Python 3. I used Python 2.x with ftfy 4.1.1 for this answer. Using the same directory, type the following command:
 ftfy -o file_clean.html --preserve-entities file.html
Optionally, you may include the --guess option to have ftfy guess your encoding, or --encoding if you know your encoding. This may produce better results.

2020. május 28., csütörtök

Resolving the 502 Bad Gateway Error in Nginx, Ubuntu 16.04 - 20.04 upgrade and PHP5 - PHP7 upgrade

PHP 7.2 Ubuntu 20.04 502 Bad gateway Error message

Set path correctly in
sudo nano /etc/nginx/sites-available/default
sudo nano /etc/nginx/snippets

BAD: fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
GOOD: fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
---


sudo nano /etc/php/7.0/fpm/pool.d/www.conf

change
listen = 127.0.0.1:9000
to
listen = /var/run/php7.2-fpm.sock


sudo apt-get -y install php7.2 php7.2-mysql php7.2-fpm php-fpm

chown :www-data /var/run/php/php7.2-fpm.sock

sudo apt install php-mysql

Reading package lists... Done
Building dependency tree     
Reading state information... Done
The following additional packages will be installed:
  php7.2-mysql
The following NEW packages will be installed:
  php-mysql php7.2-mysql
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 125 kB of archives.
After this operation, 432 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu bionic-updates/main i386 php7.2-mysql i386 7.2.24-0ubuntu0.18.04.6 [123 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu bionic/main i386 php-mysql all 1:7.2+60ubuntu1 [2,004 B]
Fetched 125 kB in 0s (266 kB/s)     
Selecting previously unselected package php7.2-mysql.
(Reading database ... 86153 files and directories currently installed.)
Preparing to unpack .../php7.2-mysql_7.2.24-0ubuntu0.18.04.6_i386.deb ...
Unpacking php7.2-mysql (7.2.24-0ubuntu0.18.04.6) ...
Selecting previously unselected package php-mysql.
Preparing to unpack .../php-mysql_1%3a7.2+60ubuntu1_all.deb ...
Unpacking php-mysql (1:7.2+60ubuntu1) ...
Setting up php7.2-mysql (7.2.24-0ubuntu0.18.04.6) ...

Creating config file /etc/php/7.2/mods-available/mysqlnd.ini with new version

Creating config file /etc/php/7.2/mods-available/mysqli.ini with new version

Creating config file /etc/php/7.2/mods-available/pdo_mysql.ini with new version
Setting up php-mysql (1:7.2+60ubuntu1) ...
Processing triggers for libapache2-mod-php7.2 (7.2.24-0ubuntu0.18.04.6) ...
Processing triggers for php7.2-fpm (7.2.24-0ubuntu0.18.04.6) ...
NOTICE: Not enabling PHP 7.2 FPM by default.
NOTICE: To enable PHP 7.2 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php7.2-fpm
NOTICE: You are seeing this message because you have apache2 package installed.



sudo service php7.2-fpm restart
sudo service php-fpm restart
sudo service nginx restart


Check /var/log/nginx/error.log if sth is still not ok.

2020. május 26., kedd

Syntax errors in translated files - Letter to poeditor.com

I've used poeditor with Google Translate to translate open source software - LearnPress and Give-WP plugins.

I've paid 8$ yet the output is full of syntax errors - special characters like & and $ are messed up, some important extra lines omitted starting with # (see e.g. Learnpress WP plugin PO file, lines: "#, php-format").

Examples from Give-WP translation - full source below:

1. Unwanted character conversion - and worse, bad output due to extra space:
msgid "Next »"
msgstr "Következő & raquo;"

2. Extra spaces added that breaks variables:
msgid "Edit Donor: %1$s %2$s"
msgstr "Adományozó szerkesztése:% 1 $ s% 2 $ s"

3. Wrong character encoding:
msgid "Before - %s&#x200e;10"
msgstr "Előtt -% s &# x200e; 10"

etc...

Original:
https://www.pastefs.com/pid/211223

Translated but with syntax errors
https://www.pastefs.com/pid/211222

The Transifex translation portal also does not accept the file you generate as an input file due to the syntax errors.

Can you fix these errors?