Showing posts with label ansible. Show all posts
Showing posts with label ansible. Show all posts

This Week I Learned - 2017 Week 04

Last week post or the whole series.

What is like to reach the end of middle age and heading towards old age? Both good and bad. The good thing is after a perennial quest of what you want out of life, you finally have some ideas on what to pursuit. The bad? Eventually reality will catch up on you. Your body is getting weaker, both physically and mentally. Distractions or rather addiction to distractions to fend off. Resistances to stay focused due to our short attention spans (made worse by increase mobile phone usage). And never ending growing lists of to-do items to check off. Hence, before this coming Chinese New Year, I've decided to do some virtual "house cleaning", remove and clear off all those pending draft blog posts, my digital drives, and others. One of the post is Using ansible-lint with Git's pre-commit. However, nothing much can be written down this week as I've limited Net access.
#1 Why you shouldn't use delay function in embedded project (Arduino). You should use non-blocking function (also known as asynchronous function) or work along the hardware timer. Working with embedded project made me realized that I'm quite ignorant about programming with constraints and limited resources. Well, if you spent most of your web development time with PHP, I doubt anyone needs to worry much about optimization, just delegates to the frameworks.

#2 "Sometimes people fit snugly into a crack in the world that fits their shape, and sometimes no such crack exists." via HN. Very well written comment.

Using ansible-lint with Git's pre-commit

While browsing randomly, I stumbled upon the linter for Ansible called, you guess it, ansible-lint. However, another interesting utility came up called pre-commit, which is a framework to manage your Git's pre-commit hooks.

Installation is simple. Use `pip` to install it.
$ sudo -H pip install pre-commit

Create the config file, `.pre-commit-config.yaml` and add the content below.
- repo: https://github.com/willthames/ansible-lint.git
  sha: v3.3.3
  hooks:
    - id: ansible-lint
      files: \.(yaml|yml)$


Install the necessary tool.
$ pre-commit autoupdate
Updating https://github.com/willthames/ansible-lint.git...already up to date.

Install to the repository's `pre-commit` hook.
$ pre-commit install
pre-commit installed at /home/ang/src/dotfiles-ansible/.git/hooks/pre-commit
$ git commit
[INFO] Installing environment for https://github.com/willthames/ansible-lint.git.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...

This Week I Learned - 2016 Week 30

Looking back to the last week post or you might want to check out the whole series.

How to sort a hash in Perl. However, that is only for one column or key. How about multiple keys or columns? Similar, just with additional criteria.

Why SSH takes a long time to connect? Just update the SSH daemon configuration file.
$ vi /etc/ssh/sshd_config
GSSAPIAuthentication no
UseDNS no

DebOps. A great showcase on using Ansible. Unfortunately, it still did not solve one of the main issue server provision on multiple distros as this only works on Debian or Debian-based distros. Meanwhile, there exists another tool, Molecule, to help testing Ansible under different environments.

Speeding up APT? Use Apt-fast, which is a wrapper for Apt which use different downloader which support parallel downloads.

Good introduction to Vue.js. Note that this is for version 1.0 but the concept still relevant.

How to implement infinite scrolling. Surprisingly the concept is very simple.

Probably the best REPL for Perl, Reply.

This Week I Learned - 2016 Week 08

Last week post.

#1 NameError: name 'basestring' is not defined. Surprisingly there is still conflict with Ansible when installed using pip for Python 2 and Python 3.

#2 GNU/Linux Performance. Poster of tools you can use to investigate performance issues with your system.

#3 Container as Python module. (HN discussion) Interesting concept indeed. I've been looking at Docker for the past three weeks and this is probably best interesting use of container. It's useful when you want to build up an actual test environment from your Python apps or scripts. Instead of Mock object, you can test against the actual system, for example, an actual database system.

#4 Xamarin sold to Microsoft. (HN discussion). What took them so long? I read (can't remember where), it was sold for 400 millions. Interesting to see how this unfold in coming future.

#5 Non Zero Day. (HN discussion) Effective way to build a new habit through chain-method or streak. No, Jerry Seinfield did not create the Seinfield productivity program. For me, almost daily Git commit. You have to get started on something, the baby step..

This Week I Learned - 2016 Week 03

In case you miss out, last week post.

#1 The Happiness Code. Using rationality to overcome bad mental habits. For programmer, is like identifying the bottleneck of a legacy system and then refactor and optimize it. In other words, hack yourself. I agree with one of the comment, seems like a rediscovery of Cognitive Behavioural Theraphy (CBT) to me.

#2 The Akrasia Effect: Why We Don’t Follow Through on What We Set Out to Do. (HN discussion) Struggle with self-control and making bad decisions against your best interests while knowing it? You're in Akrasia state. Procrastination is an exemplar of such self-denial mental state. There is a step-by-step visual guide on beating procrastination through identifying your motivation. I firmly believe that motivation is related to willpower as written by Roy Baumeister in his book, Willpower: Rediscovering the Greatest Human Strength. Strong willpower correlates with keeping yourself healthy though enough sleep, adequate exercise, and stress management.

#3 Upgrade to Ansible 2.0. Already encountered one showstopper bug, fixed but does not seems release out yet. Also, more explicit deprecation warning of using 'sudo' instead of 'become' as privilege escalation method. Lots of changes needed for my dotfiles using Ansible.

#4 Can't boot into graphical login by default through Systemd and Lightdm seems corrupted. It seems I've messed up my Ubuntu installation after I nuked the Gnome 3 and reverted back to Unity desktop. I'm too accustom to SysV init system and it going to take a while for me to get acquitted with Systemd. Need to remember the runlevels used as runlevel 1 (rescue.target), runlevel 3 (multi-user.target), and runlevel 5 (graphical.target).

#5 ERROR 1524 (HY000): Plugin 'unix_socket' is not loaded. Weird behaviour when I downgrade from Maria 10.0 to MySQL 5.6, MySQL client login as root won't work. When come to reading multi-pages forum post, never try the first solution purposed. Always start reading from the last page and moving backward. It seems this was due to leftover configuration of MariaDB where authentication using UNIX socket is not enabled by default. Purged both MariaDB and MySQL and installed PerconaDB instead. However, even PerconaDB has its own rather idiotic issue with AppArmor.

#6 The sound of the dialup, pictured. Bring back all those nostalgia memory of connecting to the Internet using your dial-up modem. I still remember the agony and disappointment when the download failed at 99% and can't be resumed. So close yet so far.

#7 We all should get a FitBit or something equivalent. Our body always trying to tell us something but we tend to ignore it. Use this as a monitoring tool to 'listen'. It's alarming that the lack of quality sleep can have such damaging effects to our health and shorten our lifespan.

#8 What 20 years difference makes. With passion, fueled by persistency, and self-exploration and guidance, one can live up to his/her childhood dream. The 10 thousand hours rule at work here.

#9 Working with CSVs on the Command Line. Using common Unix utilities (cat, grep, awk, and the like) to manipulate CSV file. Similar post that describe the usage but grouped by intention. There is also more refine CSV processing console tools like csvtool, csvfiltercsvkit (the equivalent GUI version is OpenRefine), txt-sushi, and tabulator.

#10 Have a Panda's Series or DataFrame? You can sort both data structures either by index, using sort_index() or by values, using sort() or sort_values().

This Week I Learned - 2016 Week 02

In case you miss out, the last week post

#1 Code-Switching to Improve Your Writing and Productivity. A discussion of ways to prevent yourself from fixated or "over baking" on your work while writing or coding. The gist of the approach is the switching between different writing assignments regularly. Just write and keep the momentum going.

Note: I've just realized while writing this post, I was applying her approach where each item in this post is a different topic for me to explore, investigate, learn, and jot it down concurrently. I was jumping between the items.

#2 The Best American Essays. You can find the list of essays for the year 2015. As stated in #1, to improve your writing, you need to read, learn, and mimic from the best essayists.

#3 The Easy Way To Learn Hard Stuff. To master any skill (in the context of programming), build stuff and built it starting from day one! Don't be obsess with elements (syntax and semantics) of the programming languages, use these elements to build something. In other words, don't focus on the tools, use the tools for all its intended purposes. For more general disciplines, the Coursera's course on Learning How to Learn is a good place to start. Plenty list of researched learning techniques.

One such technique is read, recall, and write it down (HN dicusssion) or similarly PQRST method. There is a worries that rote learning may lead to mere memorization, but without the information inside your head in the first place, how can you think and connect all the dots? I like the application of this technique in programming. Basically learn enough fundamental and challenge yourself to build something up from scratch without any references until your're really stuck. I experience once before while picking up Nim programming language. I was stuck with just a documentation and without Internet access. So, you're pretty much have to learn the hard and slow way but definitely you'll learn fast. Why so? One good reason, without Internet, there is not distraction or excuses for your to procrastinate.

#4 Already few days into the new year. Still contemplating on your new year's resolution? The US government has a list of popular new year's resolutions. Moreover, for each resolution, there is plenty of resources to guide you. Give it a try! For programmer, there is always the resolutions for programmer (HN discussion) which I covered it last week.

#5 Remember Dark Patterns, the deceptive user interface patterns to trick people? Now we have something similar but the opposite. GoodUI, a site which list good user interface patterns which have been heavily A/B tested.

#6 Ansible 2.0 has been released (Thre is a good HN discussion on YAML vs. Bash script). I have been anticipate this release especially the package module which let us install software using underlying package manager. Unfortunately, this only works if the package name is the same through all the GNU/Linux distributions, which is not so for most of the time. Also block is a welcoming feature which help to group related tasks by distribution like using 'ansible_distribution'.