Install Python on Ubuntu

Check the latest version here At the time of writing, 3.8.0 is the latest and 3.8.5 has release candidate. Also make sure you have sqlite3, libbz2-dev and libffi-dev are installed sudo apt-get install libsqlite3-dev libbz2-dev libffi-dev version=3.8.5 wget https://www.python.org/ftp/python/${version}/Python-${version}.tgz tar xzvf Python-${version}.tgz cd Python-${version} # Linux (or any Unix-like system), the default prefix and exec-prefix are /usr/local. # thus you should be able to omit --prefix here # --enable-optimizations option for significant speed boost (10-20%) but much # slower build process ./configure --prefix /usr/local --enable-optimizations make sudo make install # OR if you want to skip creating the python link then: sudo make altinstall in case you want to remove and re-install it again cause some software was missing before installation ...

October 15, 2018 · 1 min · Naoko Reeves

Fun Indoor Training

The Goal: Decide on most money worth indoor cycling bike and software options. Motivation: I run almost everyday but some days, my knee hurts and some days it rain on me. For those reasons, I have been thinking of other cardio option other than running and swimming. Biking seems so fun with right software and easy on your knee. Software Just like computer, without right software device (bike) won’t be much useful. You will be more motivated if software is good (addictive and stress free) and you will hopefully use your device to the full potential. ...

October 3, 2018 · 4 min · Naoko Reeves

How to setup custom domain in Blogger via Namecheap

The Goal: You got blog going with Blogger and now ready to setup custom domain! How to setup custom domain? First, you will need to register your domain. To register your domain, you want to go through domain registrar. To become the domain registrar, you will need ICANN Acrediation so you want to go ahead register through registrar instead of becoming one. Now there are many of them out there. The popular ones are likely GoDaddy. I see Google is providing this service too. I decided go to with NameCheap.com for a few reasons: ...

September 3, 2018 · 2 min · Naoko Reeves

Elasticsearch Access

The problem: You installed Elasticsearch on server. You can run curl localhost:9200 and all looks good but the access is denied from outside when curl <server-ip>:9200. How to solve it So first thing first. Elasticsearch do need to listen to ip you are accessing. To make it listen to all, you can simply change / add network.host: 0.0.0.0 to /etc/elasticsearch/elasticsearch.yml and restart elasticsearch server. Try curl <server-ip>:9200 and works? That’s great. Your server is configured / ready for port 9200. ...

August 22, 2018 · 4 min · Naoko Reeves

Intercept Python Logging

The problem: I need to ship specific log record and had formatter written in python. It is pretty complex transformation. I thought of using Logstash but I then need to either convert this python logic or write a plugin to use already written python parser. Plus I need to install logstash… I wanted a simpler solution How to solve it Use custom python logging Handler and Filter! import logging messages = [] logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) class ListenFilter(logging.Filter): def filter(self, record): """Determine which log records to output. Returns 0 for no, nonzero for yes. """ if record.getMessage().startswith('dont: '): return False return True class RequestsHandler(logging.Handler): def emit(self, record): """Send the log records (created by loggers) to the appropriate destination. """ messages.append(record.getMessage()) handler = RequestsHandler() logger.addHandler(handler) filter_ = ListenFilter() logger.addFilter(filter_) # log I want logger.info("logme: Howdy!") # log i want to skip logger.info("dont: I'm doing great!") # prints ['logme: Howdy!'] print(messages) Cheers!

July 26, 2018 · 1 min · Naoko Reeves