...
Just my blog

Blog about everything, mostly about tech stuff I made. Here is the list of stuff I'm using at my blog. Feel free to ask me about implementations.

Soft I recommend
Py lib I recommend

I'm using these libraries so you can ask me about them.

Python HTMLParser

py_vk How to spent two days if you know nothing about Python:

  • need parse HTML page code, where VK id and username of every person who shared post stores

 

with open('test.html', 'r', encoding='utf-8') as content_file:
    read_data = content_file.read()

from html.parser import HTMLParser
import re

class MyHTMLParser(HTMLParser):
    def handle_starttag(self, tag, attrs):
        vk_id = str(attrs)
        for line in vk_id:
            vk = re.findall('/\S+$', vk_id)
        vk_fnd = str(vk)
        if re.search('/\w+\'\)\]', vk_fnd):
            global vk_read
            vk_read = vk_fnd
            for ch in ['/', ')', '[', ']', '"', "'"]:
                if ch in vk_read:
                    vk_read = vk_read.replace(ch, "")
    def handle_data(self, data):
        global vk_name
        vk_name = str(data)
        assert isinstance(data, object)
        for line in vk_name:
            if re.match('\S+\s+\S+$', vk_name):
                print("@{0} - {1}".format(vk_read, vk_name))
                break


parser = MyHTMLParser()
parser.feed(read_data)

Now I know more. First bug and first fix: UnicodeEncodeError: 'charmap' codec can't encode character '\u0406' in position 15: character maps to <undefined>

with open('test.html', 'r', encoding='utf-8') as content_file:
    read_data = content_file.read()
'''
1. …

Read...

Installation Perforce Helix Proxy

From here Download here

Installation on Windows

Just using installer: Windows evidence:

C:\Program Files\Perforce\Proxy>p4p.exe -V
Perforce - The Fast Software Configuration Management System.
Copyright 1995-2015 Perforce Software.  All rights reserved.
This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit (http://www.openssl.org/)
See 'p4 help legal' for full OpenSSL license information
Version of OpenSSL Libraries: OpenSSL 1.0.1l 15 Jan 2015
Rev. P4P/NTX64/2015.1/1028542 (2015/03/20).

And looks like there is nothing different with p4d.exe in logic. [su_spoiler title="p4p.exe -h"]

C:\Program Files\Perforce\Proxy>p4p.exe -h
Usage:

    p4p [ options ]

    Proxy options:
        -d              run as a daemon (fork first, then run)
        -f              run as single-threaded server
        -i              run for inetd (socket on stdin/stdout)
        -q              suppress startup messages
        -c              Do not compress proxy <-> server connection

    General Options:
        -h -?           print this message
        -V              print server version

        -r cache        set proxy cache directory (default $P4PCACHE)
        -v level        debug modes (default $P4DEBUG)

        -L …

Read...

Plone installation

Will try to use Plone CMS for test cases, interesting to see what and how CMS on Python worked. Start here: https://plone.org/documentation/manual/installing-plone/installation-quick-guide For Python: Guide and I've use only one part from it here. I've done everything as guided above.

[root@web Python-2.7.6]# ls -ltr /usr/bin/python*
-rwxr-xr-x. 2 root root 4864 Jan 22  2014 /usr/bin/python2.6
-rwxr-xr-x. 2 root root 4864 Jan 22  2014 /usr/bin/python
lrwxrwxrwx. 1 root root    6 Nov  2 15:46 /usr/bin/python2 -> python
[root@web Python-2.7.6]# ls -ltr /usr/local/bin/python*
-rwxr-xr-x. 1 root root 6214493 Apr 20 11:44 /usr/local/bin/python2.7
-rwxr-xr-x. 1 root root    1674 Apr 20 11:48 /usr/local/bin/python2.7-config
[root@web Python-2.7.6]# echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
[root@web Python-2.7.6]# which python
/usr/bin/python
[root@web Python-2.7.6]# sudo sh
sh-4.1# which python
/usr/bin/python
sh-4.1# python
Python 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2

And Python lives here! Can have some troubles, like:

[root@web plone]# ./install.sh standalone

which: no python2.7 in (/sbin:/bin:/usr/sbin:/usr/bin) …

Read...

Заводим питончика дома или установка Python на Centos 6

Хороший гайд pythonздесь: https://github.com/h2oai/h2o/wiki/Installing-python-2.7-on-centos-6.3.-Follow-this-sequence-exactly-for-centos-machine-only

How to install Python 2.7.6 on CentOS 6.3 (6.2 and 6.4 okay too, probably others)

stolen from Daniel Eriksson. Thanks Daniel! http://toomuchdata.com/2012/06/25/how-to-install-python-2-7-3-on-centos-6-2/ (modified a little) CentOS 6.2 ships with Python 2.6.6 and depends on that specific version. Be careful not to replace it or bad things will happen. If you need access to a newer version of Python you must compile it yourself and install it side-by-side with the system version. Here are the steps necessary to install Python 2.7.6. Execute all the commands below as root. Either log in as root temporarily or use sudo.

Install development tools

In order to compile Python you must first install the development tools:

yum groupinstall "Development tools"

You also need a few extra libs installed before compiling Python or else you will run into problems later when trying to install various packages:

yum install zlib-devel
yum install bzip2-devel …

Read...

Redmine update 3.0.1

Redmine Update

Great, there is a new Redmine 3.0.1 published!

[su_note]Note! Redmine 3.0.1 has A LOT of unsupported plugins from old versions! Better remove them all and update it without plugins and than move back one by one.[/su_note] Some plugins can produce error like: [su_spoiler title="rake generate_secret_token"]

root@tet-redmine www/redmine# rake generate_secret_token
[DEPRECATION] requiring "RMagick" is deprecated. Use "rmagick" instead
Warning: you should require 'minitest/autorun' instead.
Warning: or add 'gem "minitest"' before 'require "minitest/autorun"'
From:
  /var/lib/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
  /var/lib/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
  /var/lib/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
  /var/lib/gems/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
  /usr/lib/ruby/1.9.1/test/unit.rb:3:in `<top (required)>'
  /var/lib/gems/1.9.1/gems/bundler-1.8.1/lib/bundler/runtime.rb:85:in `require'
  /var/lib/gems/1.9.1/gems/bundler-1.8.1/lib/bundler/runtime.rb:85:in `rescue in block in require'
  /var/lib/gems/1.9.1/gems/bundler-1.8.1/lib/bundler/runtime.rb:68:in `block in require'
  /var/lib/gems/1.9.1/gems/bundler-1.8.1/lib/bundler/runtime.rb:61:in `each'
  /var/lib/gems/1.9.1/gems/bundler-1.8.1/lib/bundler/runtime.rb:61:in `require'
  /var/lib/gems/1.9.1/gems/bundler-1.8.1/lib/bundler.rb:134:in `require'
  /var/www/redmine/config/application.rb:5:in `<top (required)>'
  /var/www/redmine/Rakefile:5:in `<top (required)>'
  /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/rake_module.rb:28:in `load'
  /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/rake_module.rb:28:in `load_rakefile'
  /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:689:in `raw_load_rakefile'
  /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:94:in `block in load_rakefile'
  /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
  /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:93:in `load_rakefile'
  /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:77:in `block in run'
  /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
  /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
  /var/lib/gems/1.9.1/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
  /usr/local/bin/rake:23:in `load' …

Read...

The conclusion after migration VMvsHyperV

So, what can I say before migration? The first day looks good, nothing leaks, all services work as expected, and have some additional configuration for MAC addresses etc. During migration, I accidentally lost one system disk for one of my VM and photos backup disks, but this is not an issue, because all important stuff has more than one backup.

VMvsHyperV_result.PNG

 

  • The first expression about Hyper-V - it's more thrifty to system resources, I'm still tuning it to make my vms run smoothly but this is the first thing I saw.
  • Then, Hyper-V has a good mgmt console for all my needs, I have a small env. so I do not need a HUGE MGMT-VM to host vCenterServer because of the new VM ver. cannot be managed just from preinstalled vC-client.
  • Linux Vms such as Centos 6, Debian etc look good and running happily, the only change I've made - …

Read...

Get Acess to VMFS from Windows (Vmplayer+Centos6)

Required:

  • http://www.eastern.nl/2014/12/mounting-vmfs-centos-7/
  • http://www.tecmint.com/how-to-enable-epel-repository-for-rhel-centos-6-5/

Above May not work. So make a VMplayer VM with ESXi installation and mound physical disk where VMFS present. http://www.empirion.co.uk/vmware/vmware-vsphere-client-direct-download-links/ This is the biggest technical perversion I've ever did: There are:VM-vs-MS_pervertion

  • VmWare
    • Vmplayer + ESXi
    • mounted IDE disks with VMFS
    • bridged network
    • vSphereClient
    • added datastores
    • added NFS datastore to host where vmplayer runs (thought it were faster then just download)
  • Windows Server 2012
    • NFS role and share
    • enought space

Bad method. Spent to much time. [su_box title="Warning IMHO!" box_color="#e4b7b7"]Send to the furnace all other ways to download vmdk from vmfs disks at EESXi, do it this way:[/su_box]

  • On the host where you installed Windows 2012 (for example) and where HDD with ESXI disks is mounted install one of this
    • Hyper-V role
    • vmware player

[su_note]I assume you're smart enought to not install OS on the same disk where ESXi host kept it's filesystem?[/su_note]

  • Then create new virtual machine …

Read...

vmdk madness!

When reading a lot of guides how better migrate from ESXi to Hyper-V I've saw some madness and then I become mad too. I decided to copy important VMs, which I don't want to break, on my laptop. YEAH! VMX-VMDK   Guess what? I bet when I'll migrate almost VMs to Hyper-V one last VM wouldn't convert and I will run it under the VMbox with bridged NIC from Windows Server with Hyper-V. I feel it would be exactly like that!

Read...

Virtualization matrix

Very useful, much informative, wow! vm-matrix   http://www.virtualizationmatrix.com/matrix.php?category_search=all&free_based=1

Read...

from VmWare to Windows Hyper-V

So! This time has come! I will switch my virtual enviroment from Vmware to Windows Server 2012 + Hyper-v. I'm tired because of ESXi leak of RAM and CPU and unaviability to check a lot of health statements of my tower. If you are interested in this, grab y'r popcorn and check my tag "VMvsHyperV" in blog to watch my struggle! Let the battle begins! VM-vs-MS   Useful stuff:

  • http://redmondmag.com/articles/2014/06/01/migrate-to-hyperv.aspx
  • http://www.microsoftvirtualacademy.com/training-courses/vmware-to-hyper-v-migration

For convertion:

  • http://www.microsoft.com/en-us/download/details.aspx?id=42497
  • http://interface31.ru/tech_it/2014/03/konvertiruem-virtualnye-mashiny-vmware-v-hyper-v-i-obratno.html
  • http://blogs.technet.com/b/canitpro/archive/2013/03/24/step-by-step-migrating-from-vmware-to-microsoft-hyper-v-server-2012.aspx
  • https://social.technet.microsoft.com/Forums/windowsserver/en-US/bbcfd6d6-10d6-4c56-8129-0fd10374f1ed/convert-vmfs-volumes-to-hyperv?forum=winserverhyperv
  • http://cmsource.net/2014/02/02/convert-vmware-vmdk-files-to-vhdx-for-use-with-hyper-v-for-free/

How to access to VMFS:

  • https://code.google.com/p/vmfs/wiki/CLI
  • http://woshub.com/how-to-access-vmfs-datastore-from-linux-windows/
  • http://digfor.blogspot.com/2011/04/accessing-vmfs-partitions.html
  • http://www.ryanbelanger.com/access-a-vmfs-drive-under-windows/
  • http://www.vm4.ru/2011/02/vmfs-troubleshooting.html

VMplayer:

  • http://www.vmware.com/products/player/playerpro-evaluation.html

Read...