nullptr

C# yaml config

yaml is pretty good way to define config for an application rather than xml file. There are many libraries available for parsing yaml in C#. Two of the libraries i tried are: yamlconfig and sharpyaml. I liked the general concept behind yamlconfig but it wasn’t that good to just integrate and get started, so I chose sharpyaml over it.

The thing I liked about sharpyaml is how easy it is to get it going, I did not had much success with yamlconfig. Also yamlconfig looks far too fancy with Injectors and what not- to just get a simple yaml parsed. Anyway enough ranting.

Lets look at some code. This is the yaml file I want parsed:

vimrc

These days vim is preferred editor, and have started using it at work and home alike. That means my vimrc kept evolving and had to sync at both the sites. Thought would back it up some where I can handily find it when required.

This post has all the contents of my vimrc as backup

deleting all matching files recursively

I am a big fan of linux command line utils and work with many of those on windows as well. One of the commands I have started to like is xargs. I Like the way you could compose commands with pipes. Have tried using xargs on windows without much success.

One of the things I often use this is to clean temp directories of certain log files. My linux commands would have been:

1
find . -name "*.syslog" | xargs rm

Now I could have done this on windows as:

1
dir /s /b *.syslog | xargs rm

but xargs dies with environment being too large, instead had to switch to a less elegant solution:

1
forfiles /s /p . /M *.syslog /c "cmd /c rm @path"

simple nodejs server

Been playing with d3js, now that most of the browsers won’t let me load files from disk. To get around this I am using node as my local server. But it is very bare bones.

To make node behave as file server I installed two node-modules: connect and serve-static Once that is installed code for static server is (server.js):

1
2
3
4
5
let connect = require('connect');
let serveStatic = require('serve-static');
connect().use(serveStatic(__dirname)).listen(8080, function(){
    console.log('Server running on 8080...');
});

To get the server up and running, execute node server.js and connect thru browser.

controlling processor frequency

My aging MacBook Pro just got a new life (Apple replaced main-board due to graphics card issue), it worked out pretty good. Thought it is perhaps time to upgrade to Windows 10. Now that i have upgraded fans won’t stop whizzing, they were running at full speed even when the CPU is idling.

Seems like some sort of bug, didn’t wanted to mess around much hardware setups and did not wanted to install fan speed controlling utility as well. Found a cool setting that gave me what i wanted, thing is to clamp down frequency.