Skip to content

{ Author Archives }

https authentication in nginx

In order not to forget again how to setup http authentication in nginx here is a reminder. For https, follow these steps: $ sudo -s # cd /etc/nginx # openssl req -new -x509 -nodes -out server.crt -keyout server.key and add these lines to your server instance: server { listen 443; ssl on; ssl_certificate /etc/nginx/server.crt; ssl_certificate_key [...]

Tagged , ,

ulint, Universal Lint

I’ve been using so many code static checkers lately, that I decided to write a wrapper around the ones I use the most. I called it: Universal Lint, ulint for short. At the moment, Python, Javascript and Haskell files are supported, but adding new linters/extension is trivial. Download it and use it!

500 on Youtube on non-existing videos

Now, this is embarassing… It looks like requesting a non-existent video on Youtube causes a “500 Internal Server Error”! For example: Valid url: http://www.youtube.com/watch?v=b5CeNunbHto Invalid url: http://www.youtube.com/watch?v=wtf Surely, a better response would be something like the one returned when  the videoId is misisng: http://www.youtube.com/watch?v= Seems like predictions became true.

HSGrep benchmarking

Few days ago, I rewrote sgrep in Haskell. I was curious to know how it compares to grep in term of execution speed. In particular, I was interested to verify that hsgrep scales as O(log n), instead of O(n), with n being the size of the file analyzed. First of all, in order to have [...]

Tagged , ,

HSGrep: Sorted Grep in Haskell

As an exercise to learn Haskell, I wrote a specialized grep to work on sorted files. It uses binary search to scan a text file and print all the (consecutive) lines that start with a user defined string. My program is a rewrite of sgrep in Haskell: I called it HSGrep. Code is available on [...]

Tagged , ,

git pre-commit hook for python and javascript

Following a recent discussion on HN, I decided to share my own git pre-commit hook. It’s a work-in-progress, so you can find the most updated version here. To use it, just drop it in your .git/hooks directory. At every git commit, it will run pep8 and pyflakes on .py files, and gjslint on .js files.

Tagged , , , , , ,

Haskell and VIM

I had to tinker quite a bit before finding a decent configuration for vim to edit Haskell files. Here are the packages and config files I use: Haskell mode: interaction with Haddock, compiler integration, and other general settings. Indentation: proper source code indentation. More configs to enforce good style (no tabs, tabstops, etc.):  You can [...]

Tagged , ,

they broke delicious

the new redesign of delicious.com broke so many things, that I thought I had to take notes: bookmarklet in Chrome can’t be drag-n-dropped to the toolbar. its javascript code is also hard to copy and paste to create the bookmarklet “manually”. install links for the chrome and firefox extensions redirect to empty pages. documentation for developer [...]

Tagged

http client in haskell

To try to make sense of this, I decided to write a “simple” http client in Haskell in as many styles as I could think of: it’s a long time since I found so many new concepts while studying a new programming language…

Tagged , , ,

pylint.vim

vim + python + pylint is a powerful combination, especially when using this vim plugin. unfortunately, the script stopped working after a pylint upgrade: you can download the fixed version here! if interested, the patch looks like this:

Tagged , ,