IT notes


Webscraping using python + chrome In mac OS X, install chromedriver and selenium: brew install chromedriver Install selenium via pip: pip install -U selenium if required to install globally sudo pip install selenium To test, open a terminal, type python and try: Python 2.7.12 (default, Oct 11 2016, 05:20:59) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] on darwin Type "help", "copyright", "credits" or "license" for more information.

12 factor

The Twelve Factors 1. Codebase Everything in revision control including environment configuration git flow master - production develop - staging 2. Dependencies Explicitly declare and isolate dependencies 3. Config Store config in the environment In a twelve-factor app, env vars are granular controls, each fully orthogonal to other env vars. They are never grouped together as “environments”, but instead are independently managed for each deploy. This is a model that scales up smoothly as the app naturally expands into more deploys over its lifetime.


dnsmasq forwarding zones If you are using dnsmasq and need to forward a DNS zone to a specific DNS server, add this to your /etc/dnsmasq.conf server=/test/ server=/sopas/ If you don’t have the file /etc/dnsmasq.conf check for directory /etc/dnsmasq.d and there create a file named /etc/dnsmasq.d/my-zones with the content of your zones That means that requests made do *.test will be forwarded to for *.sopas to and so on

ssh rsa public key encryption

Encrypt a file using ssh public keys. Create ssh public key in PEM format: ssh-keygen -f -e -m PKCS8 > Use openssl to encrypt/decrypt Encrypt: openssl rsautl -encrypt -pubin -inkey ~/.ssh/ -ssl -in test.txt -out test.txt.enc Decrypt: openssl rsautl -decrypt -inkey ~/.ssh/id_rsa -in test.txt.enc -out test.txt.enc.txt

reset qnap virtual switch

To reset the QNAP Virtualization Station, rename the file: /share/CE_CACHEDEV1_DATA/.qpkg/.QKVM to /share/CE_CACHEDEV1_DATA/.qpkg/.QKVM-backup From the App center remove/install the Virtualization Station.

E437 terminal capability cm required

When trying to open vi/vim the following message could appear: "E437: terminal capability "cm" required" To fix it type: $ export TERM=xterm

aws uptime

AWS >= 657 days OS: FreeBSD 8.2 AWS: us-east-1 Type: t1.micro

debian parted

Resize AWS Debian Jessie Probably instance will have 8GB, to extend the disk, for example to 40GB do this: Install parted: $ apt-get install parted Run: $ /sbin/parted ---pretend-input-tty /dev/xvda resizepart 1 yes 100% Resize2fs: $ resize2fs /dev/xvda1 Run lsblk: [email protected]:~# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 40G 0 disk `-xvda1 202:1 0 40G 0 part /


Release pipeline CI & CD

Raspberry Pi 1 Model B

Raspberry Pi 1 Model B, FreeBSD + wifi cat /var/run/dmesg.boot: KDB: debugger backends: ddb KDB: current backend: ddb Copyright (c) 1992-2016 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 10.3-RELEASE #0 r297264: Fri Mar 25 08:01:14 UTC 2016 [email protected]:/usr/obj/arm.armv6/usr/src/sys/RPI-B arm FreeBSD clang version 3.