Posts

PassGen Pro 1.0 released

Today I publishedd on Google Play my password generator app. Yes, just another one password generator app. But I think, this app has very good interface for touch devices. Also, as I mentioned in this post , it uses a customized spinner in ActionBar. So, a few words about PassGen Pro. This is an Android app to generate passwords with native, simple, and optimized for mobile touchscreen interface. It supports five modes: Standard alphanumeric Extended with optional special symbols Extra-customized mode with using of provided symbols Special mode to generate easy to remember, but strong passwords And, generate passwords, based on MD5 hash from provided word All modes are customized, you can set password length, using of uppercase symbols, etc. Bulk mode to generate up to thousands of passwords into file also supported. You can download it from Playstore .

GPCL for PHP v. 2.3 commited to GitHub

Today I commit a new version - GPCL for PHP 2.3 - to GitHub. This is not a release, but master brunch for 2.3 stable. You can download sources from here .

Install and configure Exim 4 mail server in Debian 8

One of friends ask me to configure mail in VPS to send messages via web form. He using Wordpress, and can't write custom PHP code to send mail directly via SMTP. Only one way is acceptable here: to use PHP mail() function. Okay, in this case we need a mail server on VPS. I like Exim. To install Exim, run: apt-get install exim4-base After this, run configuration tool: dpkg-reconfigure exim4-config Make selections with using arrow keys, select “Ok” with tab key (note again, server will setup only for send mail): Select: ‘internet site; mail is sent and received directly using SMTP’ Enter FQDN: yourdomain.tld SMTP Listener: enter 127.0.0.1; ::1 Mail destinations - yourdomain.tld, local hostname, localhost.localdomain, localhost Relay Options: Leave blank Follow up Screen to Relay Options: Leave blank DNS Queries: Keep DNS queries to a minimum? select “No” Delivery method: Select “Maildir format in home directory” Choose default unsplit config file by entering “No

Create custom Spinner on ActionBar

Image
Last days I start working on new Android app, working name is PassGen (Password generator) and plan to place spinner onto the ActionBar. Since API 21 ActionBar replaced to more flexible Toolbar with you can put widgets similar to regular layout. I plan to use spinner but by default it look not fine for me. Starting from modify colors, my mind moving me to add second line and icon to each item. Finally, it looks like this: Almost changes are in XML files. In MainActivity: < android.support.v7.widget.Toolbar android :id= "@+id/toolbar" android :layout_width= "match_parent" android :background= "@color/colorPrimaryDark" android :layout_height= "?attr/actionBarSize" > < Spinner android :id= "@+id/spinner" style= "@style/SpinnerTheme" android :layout_width= "wrap_content" android :layout_height= "wrap_content" android :layout_marginEnd= &q

One billion records table in Postgresql

I have a simple table in Postgersql database with character key. CREATE TABLE public.zero_hids ( hexblock character(32) COLLATE pg_catalog."default" NOT NULL, hid bigint, CONSTRAINT zero_hids_pkey PRIMARY KEY (hexblock) USING INDEX TABLESPACE alcal ) It is required to insert into this table 1000000000 unique records by loading from CSV file. We can split this file to 5 parts by 200 millions each and insert it from command line: !/bin/bash time psql --port=5433 -d db1 -c "COPY zero_hids FROM '/tmp/table0.csv' delimiter AS ',' HEADER CSV" ... time psql --port=5433 -d db1 -c "COPY zero_hids FROM '/tmp/table4.csv' delimiter AS ',' HEADER CSV" Size of each part is around 9 Gigabytes. Allowed memory limit to Postgresql is 32Gb. Here is results: COPY 200000000 real 55m16.461s user 0m0.040s sys 0m0.008s COPY 200000000 real 89m48.861s user 0m0.048s sys 0m0.016s COPY 200000000 real 202m21.283s user 0m0.04

Deploy multiple files to multiple servers with Python

In yesterday post I describe how to upload file to multiple servers with scp, sshpass and Python. But sometimes it is required to upload multiple files. For example, I have one hundred files from split one with split command: split file . txt -- additional-suffix = . txt -- number = l/100 --numeric-suffixes f In this case files are named from f00.txt to f99.txt. And, for example, we should put this files for parallel processing on 10 servers. Of course, it is possible to make 10 archives, upload and unpack it, but better way is improve yesterday script to do this by one job, especially if we have more files and/or servers. Let's do mm-scp.py like this ( logindata.py is used some as this ): import sys from subprocess import call from logindata import ip_list user = 'root' local_path = 'upload/in/' remote_path = '/root/in/' pfx = 'f' sfx = '.txt' d = 2 fcnt = 100 scnt = 10   def func ( x ) : for ( ip , pass