wesley tanaka

Tech

strace equivalent in Mac OS X

()

Recent versions of Mac OS X have a System Integrity Protection feature which breaks the dtrace implementation installed on Mac OS X. In order to use dtrace functionality you first need to disable a portion of System Integrity Protection.

  1. Restart computer
  2. Hold down Command-R while computer boots
  3. Launch Terminal from the Utilities menu
  4. csrutil disable
  5. csrutil enable --without dtrace
  6. Restart again

Now you can use dtrace command line tools such as

Generating grpc stubs for Python from the command line

()

The GRPC quickstart guide refers to generating GRPC stubs using python code similar to run_codegen.py

When you look in this file, you see what appears to be a command line like: protoc --python_out=. --grpc_python_out=. myfile.proto

However, if you actually try to execude that command line with either protoc 2.6.1 or 3.0.0, you get this error:

Understanding protocol buffer version compatibility issues in Python

()

There are multiple protocol buffer and protobuf-related software packages available in multiple versions, as well as two major protocol buffer syntax releases. Forward compatibility does not exist, so the error messages that appear require research to understand:

Testing Ansible roles with test-kitchen and Docker using the Ansible Role Tester

()

Preparing an Ansible role to be distributed can be time consuming and error prone. Ideally, you should test it against many versions of Ansible and many operating system versions. However, doing this is time consuming.

Enter the Ansible Role Tester.

In its simplest form, you simply add this to your CI script after making sure that docker and bundler are available:

wget -O- bit.ly/ansibletest | sh

Structured log files in Python using python-json-logger

()

One approach for transferring events from your software into a log indexer software like logstash or splunk is to output them to disk in a structured format like JSON. Structured logs have some advantages over plain text logs, and the API of the Python logging module is flexible enough to output them with a custom Formatter.

Structured log files

()

Historically, logs on unix systems have been line-based. Each event is represented by a single line appended to a file. Fields of the event are separated by spaces. These logs are compact, human readable, somewhat machine readable, and easily analyzed with pipelines of command line tools like cut, sort, uniq, awk, sed etc.

Erlang Cheat Sheet

()

beam process: erlang virtual machine

.beam files: erlang binaries

erlang module is a file and the unit of compilation

erlang application is a unit of composition of functionality.  its interface is a start() and stop() function.

Importing a module from a local directory into a Puppetfile or a Gemfile

()

In a Gemfile:

gem "my-module", :path => File.join("..", "my-module")

Accessible Introduction to Software Transactional Memory (STM)

()

Fatal Error: Unable to find package java.lang in classpath or bootclasspath

()

This error: Fatal Error: Unable to find package java.lang in classpath or bootclasspath can occur when /usr/lib/jvm/default-java is missing

This can be worked around with:

cd /usr/lib/jvm
sudo ln -s java-8-oracle default-java

Syndicate content
by Wesley Tanaka