All articles

Custom snippets in vim

Set up

I use ultisnips for my snippets. To set this up, I have this in vimrc:

call plug#begin('~/.vim/plugged')

Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' " Snippet support
call plug#end()


let g:UltiSnipsExpandTrigger="<c-e>" " Default is <tab>
let g:UltiSnipsEditSplit="vertical"
let g:UltiSnipsSnippetDirectories=["UltiSnips", "mysnippets"]

This …

First Haskell Parser (for Kindle Highlights)

Kindle saves highlights, bookmarks and notes in a My Clippings.txt file. I needed a way to parse it and filter out the content I wanted. I also wanted to work on a parser in haskell, so this was a great opportunity to get my hands dirty.

I used stack …

Hiding Toolbars in Firefox

While using i3, I've realized that a lot of screen real estate in firefox is taken up with the tab and navigation bar. This isn't a problem when its the only application open, but when some tiling has been done, these two bars quickly become a barrier to usage, for …

Python Timeit with Partial

The timeit module provides an easy way to time python code. I use it to check if a new code implementation runs faster than an older implementation.

Example usage of this is:

import timeit

timeit.timeit('list(range(100))')

def greet():
    print('Hello World')

timeit.timeit(greet, number=4)

Timeit …

Working With A Bad Codebase

I've worked with codebases that have made me frustrated. Some of the **features** I've seen include:

  • Naming the variables returned by a function $this and $return.
  • Having different languages in the same project. For example, I got one which had PHP, Python, Perl, JavaScript (node in the backend) and c …

Vimwiki Website Deployment using Git Hooks

I use vimwiki to keep a track of my notes. This includes book summaries, linux commands, recipes and miscellanous content. It's an amazing vim plugin that provides easy access and navigation to the content. This however works well only within vim.

I occasionally need to access these notes outside vim …

PC Assembly and Motorola C Plus Fix

I assembled my first PC this month. It took me a full Saturday for this, and I blame it on the case I got. I cheaped out on it, and ended up taking a lot of time setting things properly inside it. Here is the build. Some of the mistakes …

Huion 420 driver setup

I bought the Huion 420 because I wanted to experiment with graphics tablet and drawing on linux. I chose this primarily because of its cost. Out of the box, the device worked on my archlinux setup, however it behaved more like a mouse, with pressure sensitivity not detected. I did …

Python Generators

Generators are functions that behave like iterators, thus can be used in for loops. For example, a generator that produces even numbers will look like:

def even_numbers(upperlimit):
    current = 0
    while current < upperlimit:
        yield current
        current += 2

Generators are also created using a syntax similar to list comprehension:

even_numbers = (n …

Ansible and SSH Port

Hackers and bots try to log into servers all the time. They do this by trying random ssh logins into your server. A deterrent to this is to disable the default ssh port and set it to something else. Also, disable root login as this is the most common user …

Page 1 / 6 »