Slack old school style

Slack has gained a lot of popularity in recent times as a tool for inter-team communication and for the right reasons. It offers a lot of features such as 3rd party software integrations, rich content communication, collaboration, bots etc. which when put together help create a rich collaborative user experience for teams to work together, especially when they are not co-located, which is fairly common these days.

If you’re anything like me and have been around long enough to know what irc is and when you look at various elements that slack provides like channels, accounts (servers), private messaging, etc. you know that it draws a lot of parallels and inspiration from that old school communication tool.

However, slacks desktop application, which is build using electron, although is very feature rich, is extremely memory hungry for my liking. I have also experienced extreme slow downs / hang ups at times. For that reason, I have always been on the look out for a way to combine the rich user experience of slack with the simplicity of irc without compromising a lot on the goodness the app provides.

Slack has always offered an IRC gateway which can be enabled by a team admin, and then you can use any regular irc client to connect. However that means that I have to compromise on a lot of features, some very basic such as editing your own messages etc and also since it needs to be enabled explicitly by an admin, its not always available.

Recently I came across wee-slack which is a slack app built as a weechat plugin.

WeeSlack

Since I had been using weechat already previously as my irc client (still do), this was perfect for me. After using it for a significant amount of time, I can say it is superb. It gives me the best of both worlds without compromise. It uses slack’s APIs and hence does not require an explicit IRC gateway feature to be enabled by an admin, moreover it gives a very text friendly API to leverage slacks features from within weechat. I would highly recommend using it as opposed to using the slack app since it is extremely light weight yet powerful.

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

WebRTC Broadcast

WebRTC is fun! I recently gave a quick session on WebRTC at Bangalore Ruby User Group (BRUG). Following are the slides of my presentation.

For demo I had recently created a demo application in elixir using the phoenix framework because it makes dealing with websockets really easy. That is used for creating the custom signaling service that is required to facilitate such a broadcast. The source code is available at dhruvasagar/webrtc-broadcast

In a nutshell for the purpose of a demo, what I essentially do is that each ‘Host’ (who access the home page at ‘/’) sends out a ‘stream-ready’ event notifying that it’s stream is ready to be shared and that is then communicated to all other hosts. This then lets them initiate the basic WebRTC signaling that’s required for them to know about each others’ audio / video capabilities by means of the offer / answer mechanism. Once that is complete, they finally receive each others’ streams and that is then added onto their views dynamically.

For listeners (who simply receive the streams, and are not required to share their streams, access the site at ‘/radio’), they initiate the process by sending out a ‘stream-request’, which the signaling server then passes forward to all hosts. Once the hosts receive the ‘stream-request’ they follow that by initiating the WebRTC signaling process for communicating their streams with the listeners (by means of offer / answer). Once the communication is established the listeners then receive the streams of all the hosts and add those dynamically to their view.

I wanted to demonstrate that once you understand the process of facilitating an offer / answer to establish the initial connection between two peers using RTCPeerConnection, rest of signaling can then be customised as per situation to facilitate any kind of complex multi peer-peer communication.

NOTE: In this demo, a broadcast implies that each host shares his stream directly with each listener. So as the number of listeners (or hosts) grow, the number of peer connections required also grows rapidly. From the perspective of achieving a scalable broadcast service (peer-peer), it may instead be better to utilise each listener to also act as a proxy host, allowing for him to be able to share the stream of other hosts to other listeners, reducing the overhead on the hosts and also reducing their bandwidth requirements.

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Pristine – ZSH Theme

A while back I posted about Amuse my prompt theme for ZSH targeting oh-my-zsh. Since this was a much appreciated theme, I would like to share another theme, Pristine, that I have created.

However, I recently switched to using Prezto. This is because it felt like a more minimalistic configuration framework for ZSH. I also wanted to get faster load times. I must say my experience has been quite good and I really like it. Obviously there are pros and cons but I digress.

Needless to say Pristine targets Prezto. It is influenced by and has a lot of similarities with Amuse. However, there are subtle changes that I feel make it more cleaner and simpler. These are the highlights of Pristine :

  1. It tells you which branch you are on if the current working directory is a git repository.
  2. It indicates the git status of the repository to highlight whether there are any changes by using a green tick (✔) for no changes or a red cross (✗) for uncommitted changes.
  3. It keeps the prompt where you type on a new line with a preceding $ sign, to make more space for typing commands.
  4. It displays both ruby & node versions in use currently on the right. I find this very useful since I often work with both.
  5. It also modifies the spell correction prompt offered by ZSH to highlight the spelling error more prominently.

Read More →

VN:F [1.9.22_1171]
Rating: 1.0/5 (1 vote cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Google open sources it’s machine learning system

I am a huge proponent of open source technologies and having worked predominantly in various web technologies in the course of my career, I mostly work exclusively with open source stacks.

In the recent past I have been very keen to try and wrap my head around Artificial Intelligence and more specifically Machine Learning, although I am still barely even scratching the surface of the nitty-gritty’s of the field, especially the mathematical underpinnings, this is still a huge deal!

Google open sourced it’s second generation machine learning system TensorFlow!

It is a production ready library which has support for running numerical computations using data flow graphs on multiple CPUs, GPUs or mobile devices! Data Flow graphs as explained here represent mathematical computations described using directed graphs where each node corresponds to a certain numerical computation whereas the edges connecting the nodes represent the data communicated between them.

The documentation looks really impressive, with lots of examples. I am really keen on trying something out with this in the near future.

Considering that this is open source, I strongly believe this will give rise to a lot of innovative & creative applications and from the looks of it bring down the entry barrier drastically of solving real-life problems where this can be applied and made use of to make intelligent systems!

The fact that it also provides portability to work on mobile devices sounds like a game changer that should definitely drive a lot of adoption within the machine learning community & we should see a lot of interesting applications leveraging mobile devices which are packed with loads of sensors collecting all kinds of data from our day to day life!

Source: TensorFlow

VN:F [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Grow your brain!

Learning is key in brain development. Of course what aspects and how much of brain function improve as a result depends on the mode / type / content & method of learning. But I am not here to talk about that. Now, this knowledge isn’t new information, we all know this already, and have seen it in good effect in children and hence we all know and understand the importance of education & sport for children.

However, I have long held a strong belief that this applies also to adults, perhaps in a slightly diminished capacity, but significant nevertheless. I recently came across this brilliant TED talk that talks about neurogenesis, i.e. a process in which the brain literally grows new neurons, which occurs in all of us! The talk goes into details of how this neurogenesis is responsible not only for improved brain function, but also has a connection to our moods, hence how we feel overall. This, obviously also establishes a connection to diseases such as depression and other similar ailments we suffer from in our day to day lives.

Now, the best part about this TED talk isn’t just that, but the fact that there are in fact ways in which we can improve neurogenesis and hence improve both our mood and brain function. And there are several things we can do which have an effect towards this, including our diet, excercise, sleep, etc. Watch the video for more details :

The take away for me from this video is that there is a strong connection between our moods & our overall mental health, i.e. neurogenesis. Hence, I believe, besides what is mentioned in the video, everything that has an impact towards our mood, both positive or negative, should have an equal impact on our overall mental well being.

Happiness literally means a better, healthier & smarter life.

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Find huge files in linux

Switching to SSD’s for better performance and compromising on disk space can be a tough decision to make. Though nowadays with the prices of SSD’s going down, it is something that a lot of people are consciously doing.

However when you switch from a 500GB (or 1TB) hard disk to an, albeit super fast, 128GB SSD, you will inevitable (having spoilt by past experiences of having ample disk space) run into situations where you need to clean out large files taking space on your disk. Something I had run into myself about a year back when I made the switch myself on my macbook. Oddly enough this problem turned out to be significant enough that I had to seek out a way to quickly find out which were the top biggest files on my file system so I could get rid of them / move to an external hard disk.

Most linux systems ship with a nifty little utility du which displays disk usage statistics. It’s actually very good and fast, however by itself it didn’t quite meet my requirements where I really wanted to see the top few biggest files. So I fiddled with it in conjunction with a few other common linux utilities and I came up with this little shell script I call findhuge which, as the name suggests, helps me find huge files:

This script allows me to search the top _COUNT results (defaults to 10) of _TYPE (defaults to ‘f’, for files) in the _DIR (defaults to the current directory). Which gives me exactly what I need.

The shell script uses find to find files recursively in a directory and then passes that through du to get their sizes in a human readable format, then through sort to sort the results by size in reverse order and head to show only the top results from that list. Neat!

VN:F [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Google Code Jam 2014 Qualifiers

Google Code Jam has always been a competition I have cherished, simply because the problems they post are brilliant and the closest to reality as compared to problems of other competitions. They’re always fun to read, disect & solve, more often than not, the solutions are reasonably trivial (especially for the qualifiers) yet extremely subtle & deceptive.

Today I want to share the solutions of 3 problems I was able to solve, the code should pretty much speak for itself because none of it is very complex.

  1. Magic Trick

    This one was the easiest of all, more of a warmup I suppose. Here’s the solution :

  2. Cookie Clicker Alpha

    Based on Cookie Clicker game developed by Orteil, this one was slightly trickier, and required a little bit of math. I solved it with a recursive algorithm first, then optimized it into an iterative one to pass for the large input. Here’s my solution with both recursive and iterative parts :

  3. Deceitful War

    This one was really subtle, easy enough to understand but hard to implement. It took me a while to put my understanding of how much being deceitful at the game called War translated to my points. Here too I solved both the normal game War and Deceitful War recursively first (it’s just easier to think recursively thanks to Lisp), then translated those to their iterative counterparts. Here is my solution with both recursive & iterative parts :

  4. VN:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.22_1171]
    Rating: 0 (from 0 votes)

VIM Custom TabLine

Hi guys,

VIM allows has an option ‘tabline’ that one can use to configure how the tab line would look like. Back when I used to use gvim, I could very easily manipulate how the text on the tab looked like by setting the ‘guitablabel’ setting, however ‘tabline’ is not all that easy to configure.

Here is what I use now :

This is what it looks like : vim tabline

VN:F [1.9.22_1171]
Rating: 5.0/5 (2 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Creating Custom Scratch Buffers in VIM

The other day I wanted to open a scratch buffer to write some temporary code and the pass it on to a repl to test it out, the idea was that I could modify it as needed and resend it back to the repl and see the changes, helps to debug easily.

So I just wrote out this simple code here that allows me to launch a scratch buffer in different ways, but the difference is I can set various options for it while creating it. First lets have a look at the code :

Now this allows me to open a scratch buffer with various options, like I could call :Sedit ft=javascript and that would open a scratch buffer with filetype javascript (and hence show the right syntax highlighting). The cool part is all these options are set local to the buffer and can just be space separated to the command. The buffer will not be listed in :ls and after you :q it will be wiped out completely from vim. Couldn’t be any simpler!

VN:F [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

VIM – Filter Quickfix List

If you are used to using the quickfix list in VIM there are times when you want to filter certain things out of the quickfix list to narrow it down to relevant results that you need. Rather than firing the quickfix command all over again with a refined expression, it is easier & often faster to simply remove items from the list. I wrote this simple vimscript to do just that.

Using the above now allows you to filter the quickfix list by calling :QFilter pattern. By default it filters the list to keep results matching the pattern but if you call it :QFilter! pattern. it will remove results that match the pattern.

VN:F [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)