Pages

Monday, May 6, 2019

Fedora 30 : Kite now works with Linux.

The development team comes with these new features for this Linux tool named Kite:
Code Faster in Python with Line-of-Code Completions Kite integrates with your IDE and uses machine learning to give you useful code completions for Python. Start coding faster today.
This tool integrates with all the top Python IDEs - Atom, Pycharm, Sublime, VS Code and Vim.
The install process is simple:
[mythcat@desk ~]$ bash -c "$(wget -q -O - https://linux.kite.com/dls/linux/current)"

This script will install Kite!

We hope you enjoy! If you run into any issues, please reach out at support@kite.com or feedback@kite.com

- The Kite Team

Press enter to continue...
Downloading kite-installer binary using wget...
Checking to see if all dependencies are installed....

Kite watches your workspace to be notified when python files change on disk. This allows us to
provide the latest information & completions from your coding environment. However, for larger
workspaces, Kite can exceed the default limits on inotify watches, which can result in a degraded experience. 

We can fix this by placing a file in /etc/sysctl.d/ to increase this limit.
Configure inotify now? (you might be asked for your sudo password) [Y/n] Y
Creating /etc/sysctl.d/30-kite.conf...
[sudo] password for mythcat: 
Running ./kite-installer install
[installer] no previous kite installation found
[installer] latest version is 2.20190503.3, downloading now...
[installer] verifying checksum
[installer] validating signature
[installer] installing version 2.20190503.3
[installer] installed ~/.config/autostart/kite-autostart.desktop
[installer] installed ~/.config/systemd/user/kite-updater.service
[installer] installed ~/.config/systemd/user/kite-updater.timer
[installer] installed ~/.local/share/applications/kite-copilot.desktop
[installer] installed ~/.local/share/applications/kite.desktop
[installer] installed ~/.local/share/icons/hicolor/128x128/apps/kite.png
[installer] installed ~/.local/share/kite/kited
[installer] installed ~/.local/share/kite/uninstall
[installer] installed ~/.local/share/kite/update
[installer] activating kite-updater systemd service
[installer] registering kite:// protocol handler
[installer] kite is installed! launching now! happy coding! :)
Removing kite-installer 
After install you need to use your email to login into Kite account.
The last step is the integrations, and Kite will install this plugin for you. If you use the vim editor, then is a good idea to take a look here.

Thursday, May 2, 2019

Fedora 30 : First test.

Fedora 30 is available now. Use these commands to see how can be updated to Fedora 30.
[root@desk mythcat]# dnf upgrade --refresh 
Waiting for process with pid 2427 to finish.
Adobe Systems Incorporated                      2.4 kB/s | 2.9 kB     00:01    
Fedora Modular 29 - x86_64                       45 kB/s |  25 kB     00:00    
Fedora Modular 29 - x86_64 - Updates             29 kB/s |  24 kB     00:00    
Fedora 29 - x86_64 - Updates                     25 kB/s |  23 kB     00:00    
Fedora 29 - x86_64                               25 kB/s |  25 kB     00:01    
packages-microsoft-com-prod                     6.4 kB/s | 2.9 kB     00:00    
RPM Fusion for Fedora 29 - Free - Updates        13 kB/s |  10 kB     00:00    
RPM Fusion for Fedora 29 - Free                  22 kB/s |  10 kB     00:00    
Visual Studio Code                              8.7 kB/s | 2.9 kB     00:00    
Dependencies resolved.
...
Upgraded:
  selinux-policy-3.14.2-57.fc29.noarch                                          
  selinux-policy-devel-3.14.2-57.fc29.noarch                                    
  selinux-policy-sandbox-3.14.2-57.fc29.noarch                                  
  selinux-policy-targeted-3.14.2-57.fc29.noarch                                 
  x264-libs-0.155-3.20180806git0a84d98.fc29.x86_64                              

Complete!

[root@desk mythcat]# dnf install dnf-plugin-system-upgrade

[root@desk mythcat]# dnf system-upgrade download --releasever=30
Before you continue ensure that your system is fully upgraded by running "dnf --refresh upgrade". 
Do you want to continue [y/N]: y
...
  - problem with installed package python2-libdnf-0.31.0-2.fc29.x86_64
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' 
to skip uninstallable packages)

[root@desk mythcat]# dnf system-upgrade download --releasever=30 --allowerasing
Before you continue ensure that your system is fully upgraded by running "dnf --refresh upgrade". 
Do you want to continue [y/N]: y
...
Transaction Summary
================================================================================
Install      92 Packages
Upgrade    2716 Packages
Remove        8 Packages
Downgrade    22 Packages

Total download size: 2.9 G
DNF will only download packages, install gpg keys, and check the transaction.
Is this ok [y/N]: y
...
Importing GPG key
...
Key imported successfully
Running transaction check
Running transaction test
...
Download complete! Use 'dnf system-upgrade reboot' to start the upgrade.
To remove cached metadata and transaction use 'dnf system-upgrade clean'
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.

Monday, April 29, 2019

Fedora 29 : About poedit tool.

In this tutorial I will briefly introduce the linux poedit tool.
Let's start installing it in Fedora 29.
[root@desk mythcat]# dnf search poedit 
Last metadata expiration check: 0:01:09 ago on Mon 29 Apr 2019 01:23:39 PM EEST.
========================= Name Exactly Matched: poedit =========================
poedit.x86_64 : GUI editor for GNU gettext .po files
[root@desk mythcat]# dnf install poedit 
Last metadata expiration check: 0:02:40 ago on Mon 29 Apr 2019 01:23:39 PM EEST.
Dependencies resolved.
...
Complete!
About this software named Poedit (formerly poEdit) shareware and cross-platform gettext catalog editor to aid in the process of language localization.
Poedit is a powerful and intuitive editor for translating interfaces that use gettext.
Available for Windows, macOS, and Linux.
What is a PO file?
The .PO file is a portable object file, which is text-based. These types of files are used in common in software development. The .PO file may be referenced by Java programs, GNU gettext, or other software programs as a properties file.
What is MO file?
The .MO files or Machine Object is a binary data file that contains object data referenced by a program.
It is typically used to translate program code and may be loaded or imported into the GNU gettext program.

These files can be provided by developer source code or you can sign in into the Crowdin.
This provides powerful tools to manage localization for projects of any type and any size.
Open the application and put all info on from File-> Preferences.
The Poedit asks some of the essential information such as your name, email address, translation memory settings, and more to change your preferences.
Set the path (absolute path) settings in your Catalog otherwise, the Poedit isn't able to use gettext from source files.
Before starting your translate issue be advice with the rules are set by GNU gettext utilities

Sunday, April 14, 2019

Fedora 29 : Install Inkscape with Flatpak Linux tool.

Today I used the Flatpak Linux tool to install the last version of Inkscape 0.92.4 5da689c313 released at 2019-01-14.
Flatpak (formerly xdg-app) is a software utility for software deployment, package management, and application virtualization for Linux desktop computers. It provides a sandbox environment in which users can run applications in isolation from the rest of the system. see Wikipedia Flatpak.
The Flatpak tool is installed by default on Fedora Workstation. To install and runt the last version of Inkscape you need to use these commands:
[mythcat@desk Downloads]$ flatpak install org.inkscape.Inkscape.flatpakref

org.inkscape.Inkscape permissions:
    ipc     x11    file access [1]

    [1] host


        ID                                    Arch   Branch Remote  Download
 1. [✓] org.gnome.Platform.Locale             x86_64 3.30   flathub 17.4 kB / 320.2 MB
 2. [✓] org.freedesktop.Platform.VAAPI.Intel  x86_64 18.08  flathub  1.8 MB / 1.8 MB
 3. [✓] org.freedesktop.Platform.html5-codecs x86_64 18.08  flathub  4.8 MB / 4.9 MB
 4. [✓] org.inkscape.Inkscape                 x86_64 stable flathub 86.1 MB / 88.6 MB
 5. [✓] org.inkscape.Inkscape.Locale          x86_64 stable flathub  8.5 kB / 18.6 MB

Installation complete.

[mythcat@desk Downloads]$ flatpak run org.inkscape.Inkscape
Gtk-Message: 22:58:01.259: Failed to load module "pk-gtk-module"
Gtk-Message: 22:58:01.259: Failed to load module "canberra-gtk-module"
The Inkscape drawing tool works well.

Tuesday, April 9, 2019

Fedora 29 : Thonny editor for python.

This Python IDE for beginners named Thonny is a simple editor with Python 3.7 built in.
The official webpage can be found here and the GitHub project page is this.
The development team is from the University of Tartu, Estonia with the help from the open-source community. Thonny grew up in University of Tartu (https://www.ut.ee), Institute of Computer Science (https://www.cs.ut.ee).
I test it today with Fedora 29 and works well.
Let's start with the first step:
[mythcat@desk ~]$ pip3 install thonny --user
Collecting thonny
...
Successfully installed astroid-2.2.5 asttokens-1.1.13 docutils-0.14 isort-4.3.17 jedi-0.13.3 lazy-object-proxy-1.3.1 
mccabe-0.6.1 mypy-0.700 mypy-extensions-0.4.1 parso-0.4.0 pylint-2.3.1 pyperclip-1.7.0 pyserial-3.4 thonny-3.1.2 
typed-ast-1.3.1
...
[root@desk mythcat]# dnf install python3-tkinter.x86_64
Last metadata expiration check: 0:21:20 ago on Tue 09 Apr 2019 09:57:24 PM EEST.

Installed:
  python3-tkinter-3.7.2-5.fc29.x86_64          tk-1:8.6.8-1.fc29.x86_64         

Complete!
This editor can be found on Fedora repo, but I used the last released version software.
[root@desk mythcat]# dnf search thonny
Last metadata expiration check: 0:36:55 ago on Tue 09 Apr 2019 09:57:24 PM EEST.
========================= Name Exactly Matched: thonny =========================
thonny.noarch : Python IDE for beginners

Thursday, March 21, 2019

Fedora 29 : Testing the dnf python module.

Today we tested with Fedora 29 a python module called DNF.
All users have used this tool.
This python module is not very documented on the internet.
A more complex example can be found on DNF tool documentation.
I tried to see what I can get from this module.
Let's start installing it with the pip tool:
$ pip install dnf --user
Here are some tests that I managed to run in the python shell.
[mythcat@desk ~]$ python
Python 2.7.15 (default, Oct 15 2018, 15:26:09) 
[GCC 8.2.1 20180801 (Red Hat 8.2.1-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> import dnf
>>> dir(dnf)
['Base', 'Plugin', 'VERSION', '__builtins__', '__doc__', '__file__', '__name__', '__package__', 
'__path__', '__version__', 'base', 'callback', 'cli', 'comps', 'conf', 'const', 'crypto', 'db', 
'dnf', 'dnssec', 'drpm', 'exceptions', 'goal', 'history', 'i18n', 'lock', 'logging', 'match_counter',
 'module', 'package', 'persistor', 'plugin', 'pycomp', 'query', 'repo', 'repodict', 'rpm', 'sack',
 'selector', 'subject', 'transaction', 'unicode_literals', 'util', 'warnings', 'yum']
>>> import dnf.conf
>>> print(dnf.conf.Conf())
[main]
assumeno: 0
assumeyes: 0
autocheck_running_kernel: 1
bandwidth: 0
best: 0
...
>>> import dnf.module
>>> import dnf.rpm
>>> import dnf.cli
>>> base = dnf.Base()
>>> base.update_cache()
True
This read all repositories:

>>> base.read_all_repos()
You need to read the sack for querying:

>>> base.fill_sack()

>>> base.sack_activation = True
Create a query to matches all packages in sack:

>>> qr=base.sack.query() 
Get only available packages:

>>> qa=qr.available() 
Get only installed packages:

>>> qi=qr.installed()
>>> q_a=qa.run()
>>> for pkg in qi.run():
...     if pkg not in q_a:
...             print('%s.%s' % (pkg.name, pkg.arch))
... 
NetworkManager-openvpn.x86_64
NetworkManager-openvpn-gnome.x86_64
coolkey.x86_64
glibc-debuginfo.x86_64
glibc-debuginfo-common.x86_64
kernel.x86_64
kernel.x86_64
kernel-core.x86_64
kernel-core.x86_64
Get all packages installed on Linux:

>>> q_i=qi.run()
>>> for pkg in qi.run():
...     print('%s.%s' % (pkg.name, pkg.arch))
You can see more about the Python programming language on my blog.

Wednesday, March 13, 2019

Fedora 29 : Use Selinux with Firefox.

Today I tested Selinux with the Firefox browser. The main purpose was to create a policy for this browser. You can use this example to create your own policies. Using Fedora 29 this problem can be resolved easily. Let's start with installing an important packet using the dnf tool.
[root@desk selinux_001]# dnf install policycoreutils-devel
Let's see the other commands used to create policies named firefox.te:
[mythcat@desk ~]$ mkdir selinux_001
[mythcat@desk ~]$ cd selinux_001/
[mythcat@desk selinux_001]$ whereis firefox
firefox: /usr/bin/firefox /usr/lib64/firefox /etc/firefox /usr/share/man/man1/firefox.1.gz
[mythcat@desk selinux_001]$ sepolicy generate --init -n firefox /usr/bin/firefox 
nm: /usr/bin/firefox: file format not recognized
Failed to retrieve rpm info for selinux-policy
Created the following files:
/home/mythcat/selinux_001/firefox.te # Type Enforcement file
/home/mythcat/selinux_001/firefox.if # Interface file
/home/mythcat/selinux_001/firefox.fc # File Contexts file
/home/mythcat/selinux_001/firefox_selinux.spec # Spec file
/home/mythcat/selinux_001/firefox.sh # Setup Script
[mythcat@desk selinux_001]$ cat firefox.te


policy_module(firefox, 1.0.0)

########################################
#
# Declarations
#

type firefox_t;
type firefox_exec_t;
init_daemon_domain(firefox_t, firefox_exec_t)

permissive firefox_t;

########################################
#
# firefox local policy
#
allow firefox_t self:fifo_file rw_fifo_file_perms;
allow firefox_t self:unix_stream_socket create_stream_socket_perms;

domain_use_interactive_fds(firefox_t)

files_read_etc_files(firefox_t)

miscfiles_read_localization(firefox_t)
[mythcat@desk selinux_001]$ cat firefox.fc 
/usr/bin/firefox        --    gen_context(system_u:object_r:firefox_exec_t,s0)
I have modified this policy generated by sepolicy by adding my own rules:
[mythcat@desk selinux_001]$ cat firefox.te
policy_module(firefox, 1.0.0)

########################################
#
# Declarations
#

type firefox_t;
type firefox_exec_t;
init_daemon_domain(firefox_t, firefox_exec_t)

permissive firefox_t;
# my rules
require {
    type unreserved_port_t;
    type http_port_t;
    class tcp_socket { accept listen name_bind name_connect };
}

########################################
#
# firefox local policy
#
allow firefox_t self:fifo_file rw_fifo_file_perms;
allow firefox_t self:unix_stream_socket create_stream_socket_perms;

# my rules
allow firefox_t http_port_t:tcp_socket { name_bind name_connect };
allow firefox_t unreserved_port_t:tcp_socket { name_bind name_connect };
allow firefox_t self:tcp_socket { listen accept };

domain_use_interactive_fds(firefox_t)

files_read_etc_files(firefox_t)

miscfiles_read_localization(firefox_t)
I used the following commands to get my own policy:
[mythcat@desk selinux_001]$ make -f /usr/share/selinux/devel/Makefile
Compiling targeted firefox module
/usr/bin/checkmodule:  loading policy configuration from tmp/firefox.tmp
/usr/bin/checkmodule:  policy configuration loaded
/usr/bin/checkmodule:  writing binary representation (version 19) to tmp/firefox.mod
Creating targeted firefox.pp policy package
rm tmp/firefox.mod tmp/firefox.mod.fc
[mythcat@desk selinux_001]$ sudo semodule -i firefox.pp
[sudo] password for mythcat: 
The semodule is the tool used to manage SELinux policy modules, including installing, upgrading, listing and removing modules. Let's see the result:
[root@desk selinux_001]# semodule -l | grep firefox
firefox