Sand Fox (old posts, page 1)
-
Composer Viz
A tool inspired by
bundle viz
command.Just look at its selfie:
Get it on my dev site: https://sandfox.dev/php/composer-viz.html
-
PHP Access Private Methods and Fields
These two simple functions can come in handy as helpers for something like PsySH. PHP >= 7.0 is required.
-
Harold Finch Uses JetBrains IDE
Yay, Harold Finch from the Person of Interest was spotted using some JetBrains IDE.
-
RubyMine Supports Markdown
Wow. It seems RubyMine and other JetBrains products now have very nice Markdown support. I haven't even noticed it until last article. (I usually had MultiMarkdown plugin installed)
Killer feature for me is that it allows working with code blocks of known languages as if it was real code, even have code completion and some basic inspections there.
-
Embracing CommonMark as the One True Markdown
As you may know, CommonMark is a project aiming to create unified and unambiguous Markdown syntax specification. So, I'm in. I want to spread the word and even use it in my own blog.
The trouble number one is that Jekyll uses kramdown by default. So we find a gem and the gem is jekyll-commonmark. Oh hell, we lost syntax highlighting :(
The trouble number two is that CommonMark standard lacks support for server side syntax highlighting. That's bad, I don't want any JavaScript on my static pages. Let's try to wrap it somehow and enable syntax highligting.
The strong side of Ruby CommonMark implementation, CommonMarker is its ability to parse a document to the abstract syntax tree, so let's use it to extract our blocks and highlight them with Rouge for example.
-
How to work with Ruby strings in C extensions
The Problem
That's about string types in C and Ruby. As you may know, C uses null-terminated strings while Ruby uses more sophisticated string type, therefore C strings cannot contain null byte while Ruby strings can. Many Ruby gems are written in C but what happens when you convert Ruby string to the C string?
-
When does journald-native work better?
There is already a nice gem called
systemd-journal
, why another one? Well, because there are some edge cases that it does not cover. I had a trouble with one. -
What Is Dead May Never Die
Let's have some fun with the Drowned God and Unix signals.
This is a simple program that catches
SIGINT
andSIGTERM
-
Kinda Blog
In the beginning there was a Gemfile. And the Gemfile contained
gem 'jekyll', '~> 3.1'
I may post some earlier notes with earlier dates
-
systemd in Zabbix
If you use Zabbix to monitor your servers you may want to monitor systemd services with it especially if you have some custom services.
These simple checks were enough for me:
systemd.unit.is-active[<unit name>] # 1 if unit is active, 0 if inactive systemd.unit.is-failed[<unit name>] # 1 if unit if in failed state, 0 if not systemd.unit.is-enabled[<unit name>] # 1 if unit is enabled, 0 if not
It's very simple. Just place
userparameter_systemd.conf
to your zabbix config dir (usually/etc/zabbix_agentd.conf.d
) with the following content:# checks to determine if specified unit is active, failed or enabled UserParameter=systemd.unit.is-active[*],systemctl is-active --quiet '$1' && echo 1 || echo 0 UserParameter=systemd.unit.is-failed[*],systemctl is-failed --quiet '$1' && echo 1 || echo 0 UserParameter=systemd.unit.is-enabled[*],systemctl is-enabled --quiet '$1' && echo 1 || echo 0