Optimize linux battery life

Ubuntu/Debian : sudo apt install tlp

to start it : sudo tlp start

to show stat : sudo tlp stat

Long time no see wordpress ! been busy lately.

unar : Extract multipart zip files on linux

Its a shock knowing that the unzip program available on linux cant easily extract multipart zip files with ease. There is alternative program unar also available to do this task efficiently.

If u have multipart zip files as follow archive.zip.001, archive.zip.002archive.zip.003 then just execute unar archive.zip.001 and extraction will begin.

To install unar on debian/ubuntu based linux : sudo apt install unar.

Soon enough goodbye november and welcome december, go away pandemic.

Python package manager

Ruby have its gem command to install package and python have pip. Since python 3.4, pip is included to default install.

On my linux mint pip command is pip3 and i try to list installed package with pip list command.

To install a package try : pip install <package name>

To search a package try : pip search <searched word>

 

Python compile to bytecode

To compile a python script to bytecode we can use py_compile module.

Above we try to compile tk_login_app.py and the bytecode available at __pycache__ folder. We can execute the bytecode as usual. This bytecode cant be used to hide your source code because one can “uncompile” it.

 

Tkinter Application with login form

Hooray this is my first python post !

Here i want to share a tkinter based application on python 3 with login form. If user is logging in by clicked a login button then login form will disappear and main form will show up. This code is not connected to database yet ! Only playing with 2 toplevel tk window placement and control its state.

Donwload py source code below.

tk_login_app

Trying postgresql c++ interface : pqxx

Postgresql database have an official interface to C programming language and a C++ interface derived from that. C++ is a different language from C and i think it will be more easier to deal with.

Lets give a try on the newest linux mint 20.

1. install libpqxx-dev package (sudo apt-get install  libpqxx-dev).

2. install codelite IDE (sudo apt-get install  codelite).

3. install postgresql (sudo apt-get install postgresql).

4. create an user (user1) for connecting to postgresql. Continue reading “Trying postgresql c++ interface : pqxx”

Java Scripting on JDK 11

JDK 11 make java command can directly run source code like other scripting language or interpreter. Lets say we have a java source file called hello.java as follow.

public class Hello {
 
  public static void main(String[] args) {
    System.out.println(“Hello World!”);
  }
 
}
 
Run the file by executing :
java hello.java
 
It works!
 
 
 
End.

Minimum Profit : A Programmer Text Editor

Minimum Profit is a text editor for programmer available to download from https://triptico.com/software/mp.html. I accidentally found this software from article related to OpenBSD and the author is the creator of this mp editor. The downloads are available in source and windows executable (Wow).

I managed to compile mp 5.38 on debian 10 using ncursesw driver which is already available on my laptop. Compilation step as follow.

Continue reading “Minimum Profit : A Programmer Text Editor”

Playing with Emacs – Open file, edit, save file.

Emacs is an editor, but not just it. Thats what i read on internet. Emacs like in a battle with Vim, another editor. I have play with vi so many years ago, but with emacs  it is just recently i learned to use it basic function.

Install it on ubuntu we can choose GUI or terminal version. I like the terminal version because it will be handy during my engagement with VM/Cloud which only can use terminal to manage it.

Open Emacs by typing on terminal emacs and press enter, it will show a welcome page like below.

We can move cursor to a hyperlink and press enter to go to particular subject, like tutorial or manual. Tutorial can also accessed using key combination C-h t, which mean press Ctrl and hold then press h, release keys, then press t. C is Ctrl and M is Meta (Alt/Esc).

Continue reading “Playing with Emacs – Open file, edit, save file.”