Report inadequate content


VCL's Varnish syntax highlighting for PHPStorm

 TAGS:undefinedIf you are looking for Varnish syntax highlighting for PHPStorm, as per today, you won't find a plugin. This post is not publishing a plugin for proper vcl syntax highlighting but a quick hack to see some coloring.

Given the fact Varnish configuration files are very similar to C I tried to associate the .vlc type to C files.  It is not rocket science but at least your eyes...


!About the blog

Harecoded is basically a development oriented blog. The contents here are very basic and tending to be generalistic recipes, some tricks and a little bit of advice. If you are in a startup or start digging into the internet development there are some posts that might be handy.

I usually do not go deep into the issues and my dedication to this blog is barely unexisting. I write randomly when I think something is of general interest, keeping only the very essence.

Historically this blog has been contributed by more people (Sergi Ambel and Manuel Aguilar) but now is managed only by me (Albert Lombarte) , the original owner.


If you have questions please use the comments to post any of them! What we write is quite basic but we can help you out with more complex stuff.

Thanks for reading!

Read more about this blog in Obolog


Solved: Firefox and IE blocking font awesome (CORS)

 TAGS:undefinedIt seemed today that Firefox was blocking the font files when using font-awesome and the web didn't work properly. But our friend Jorge from the Sphinxdev blog explained us a solution..

In order to enable automatically CORS when a TTF, OTF, EOT or WOFF file is detected you only have to create a .conf file insde /etc/httpd/conf.d with any name and paste inside:



Organizing git branches in logical folders


It is easier to find things when they are well organized. If you are a git user a good practice to name the branches would be to use descriptive names including slashes "/" (as in paths) where everything before the slash is the folder you want to use and then the logical name after it.

If you use the fantastic git graphical interface SourceTree (free for Windows and Mac)...


Automatically archive S3 backups to Amazon Glacier

Amazon S3
is an on-cloud storage service used in a variety of scenarios. On of these common scenarios is the one where you upload your server backups to S3 using any of the multiple convenient libraries and tools. 

In the other hand, Amazon offers another service more oriented to data archiving and backup named Amazon Glacier. If you store a lot of data (and I am not ...



Kill processes using string search


A lot of Linux distributions (and Mac) come with a handy command named pkill installed by default. This command is very useful to kill processes in a more natural way.

Instead of doing a kill/killall based on the ID of the process or the binary name, you can just pass a string that appears in any part of the process list, including the parameters you used to start a...


A true multiline regexp in PHP. The "I miss U" technique

 - The following regular expression matches tags that are opened and close in different lines, albeit can be used for any other purpose. It is also ungreedy, meaning that when the first closing tag is found the rest of equal tags will be ignored.

It is very easy to remember and to apply, I call it the "I MISS YOU" technique, see the why in the regexp modifiers: ...


Finding abusers. List of most frequent IPs in Apache log

Internet is full of malware and people with leisure time who will hammer your server with no good intentions, most of them will try to access well-known URLs looking for exploits of software like Wordpress (/wp-admin.php, /edit, etc...).

If you monitor for a while your access_log it's easy to find out unwanted behaviour. If you want to get a list of the most frequent IPs in...


Converting a CSV to SQL using 1 line in bash

 - The command line is very powerful and can do amazing stuff in one single line by pipelining a series of commands. This post is inspired after creating a line that mixed sed and awk, but with just only awk I'll show you an example on how to convert a CSV file to an SQL insert

Let's take an input CSV named events-2013-06-06.csv with 16 columns per line. It looks like...


Migrating a Github repo to Bitbucket (or similar services)

 TAGS:Github is awesome. Bitbucket is awesome too. They are both excellent services, but Bitbucket has a plus: it's free for private repos.

That's one of the reasons on why we decided to stop paying our $25/mo Github account for small projects and moved to Bitbucket. Although the Bitbucket guys have now a one-click "import from Github tool", the solution is so simple that I don't...