Set up HP 1020 printer in Linux Mint 18 / Ubuntu

Using open source drivers Follow the instruction from http://foo2zjs.rkkda.com/ or use my clone on git https://github.com/serge-m/foo2zjs.git: Clone the repo git clone https://github.com/serge-m/foo2zjs.git foo2zjs cd foo2zjs Compile: make Get extra files from the web, such as .ICM profiles for color correction, and firmware. Select the model number for your printer: ./getweb 1020 # Get HP LaserJet 1020 firmware file Install driver, foomatic XML files, and extra files: sudo make install Configure hotplug (USB; HP LJ 1000/1005/1018/1020)....

January 9, 2017 · SergeM

Shell commands (page moved)

Page moved here

January 8, 2017 · SergeM

Add service in ubuntu

Create a file for service your-service touch /etc/systemd/system/your-service.service Let’s assume you want to run docker container there. Put following text in the file: [Unit] Description=YourService After=docker.service Requires=docker.service [Service] TimeoutStartSec=0 Restart=always ExecStartPre=-/usr/bin/docker stop %n ExecStartPre=-/usr/bin/docker rm %n ExecStart=/usr/bin/docker run -d -p 8080:8080/tcp --name %n your_docker_image [Install] WantedBy=multi-user.target Here we first stop and delete the docker container. If it doesn’t exist we continue (there is a “-” in before the command). Run...

January 8, 2017 · SergeM

Set up Travis CI for building personal page on Github Pages with Pelican

I host my notes on github pages and I use Pelican for building html content from Markdown format. Tracis CI can be used to automate building and publishing changes. Registration on https://travis-ci.org/ is straightforward. I have only public free accounts on github. Thus I need two repositories: one containing sources and another containing html. The latter is rendered automatically via Github Pages. If I would have paid hithib account I could have only one repo with two branches: master for sources and gh-pages for html....

November 27, 2016 · SergeM

Refactoring python code. Extracting variables and other.

Pycon2016 talk by Brett Slatkin Example 1: Extract variable import random month = random.choice(MONTHS) if (month.lower().endswith('r') or month.lower().endswith('ary')): print('%s is a good time to eat oysters' % month) elif 8 > MONTHS.index(month) > 4: print('%s is a good time to eat tomatoes' % month) else: print('%s is a good time to eat asparagus' % month) Becomes: class OystersGood: def __init__(self, month): month = month month_lowered = month.lower() self.ends_in_r = month_lowered.endswith('r') self....

October 8, 2016 · SergeM

Useful python links

Books Test-Driven Development with Python Harry Percival Python Testing with unittest, nose, pytest : eBook Testing Python: Applying Unit Testing, TDD, BDD and Acceptance Testing link . Videos Outside-In TDD Harry Percival, PyCon 2016 Докеризация веб приложения на Python, Антон Егоров Thinking about Concurrency, Raymond Hettinger, Python core developer Tutorials Разработка идеального pypi пакета с поддержкой разных версий python (Rus), 2020. The Little Book of Python Anti-Patterns - an awesome collection of best practices with examples....

October 8, 2016 · SergeM

terminal setup in linux mint

Installation sudo apt-get install tmux Commands In tmux, hit the prefix ctrl+b (my modified prefix is ctrl+a) and then: ###Sessions :new<CR> new session s list sessions $ name session ###Windows (tabs) c create window w list windows n next window p previous window f find window , name window & kill window Panes (splits) % vertical split " horizontal split o swap panes q show pane numbers x kill pane + break pane into window (e....

August 7, 2016 · SergeM

Mount yandex webdav on local dir

apt-get install davfs2 mkdir /mnt/yandex.disk mount -t davfs https://webdav.yandex.ru /mnt/yandex.disk/ # check: df -h /mnt/yandex.disk/

July 16, 2016 · SergeM

Mount windows shares in linux

Use sudo if needed Mount mkdir /mnt/share mount -t cifs //windows_machine_ip/share_name -o username=user,password=urPassword /mnt/share To allow write access one has to specify owning user and group: sudo mount -t cifs //windows_machine_ip/share_name -o uid=$(id -u),gid=$(id -g),user=,password= /mnt/share Unmount umount /mnt/shares

June 19, 2016 · SergeM

deep learning

Rest API example for tensorflow. It works: demo Trained models for tensorflow TF-slim - high-level API of TensorFlow for defining, training and evaluating complex models. Doesn’t work for python 3 (see here) VGG16 and VGG19 in Tensorflow. One more here. And one more Deep learning for lazybones Inception-like CNN model based on 1d convolutions http://arxiv.org/pdf/1512.00567v3.pdf Chat (in russian) http://closedcircles.com/?invite=99b1ac08509c560137b2e3c54d4398b0fa4c175e

June 3, 2016 · SergeM