Report inadequate content

19/09/2014

Terminal tuning for Git developers in Mac

If you work with Git in the terminal there are some tweaks you might want to apply to your prompt for safer and faster coding. The following lines are part of my ~/.bash_profile file. I use it on Mac although that might work in Linux as well.

You can copy and paste this code in your ~/.bash_profile (create it if it doesn't exist), save and open a new terminal to see the...

{
}

!About the blog

Harecoded is a software development 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

23/07/2014

VCL's Varnish syntax highlighting for PHPStorm

If 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...

2/07/2014

Solved: Firefox and IE blocking font awesome (CORS)

It 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:

AddType...

10/12/2013

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)...

{
}

6/12/2013

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 ...

23/11/2013

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...

16/09/2013

Force kill of processes in Windows

Sometimes Windows Tasks Manager is not able to kill an in-memory process. We try to close it several times with no luck :(

For these frustration moments we can make use of a console command named TaskKill

With TaskKill the pain ends simply with:

taskkill /IM filename.exe /F

More info about taskkill: http://technet.microsoft.com/en-us/library/cc725602.aspx

8/08/2013

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: ...

25/06/2013

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...

7/06/2013

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...