Think In Geek

In geek we trust

Uncategorized

A small Telegram Bot in Go

The Problem I started using Telegram a few years ago. Most of the time I don’t use it much to have 1 to 1 conversations but rather chat in a small group of friends which I’ve known for a while now. Every now and then, we share some links to Twitter on that group, and […]

When an array is not an array

The C programming language comes with its own set of warts if we closely examine its syntax and semantics. One of the oddities that puzzles most people is the fact that there are no parameters of array types in C. This fact, though, does not prevent one using the array syntax in a parameter.

, , , ,

TinyMCE checkbox toggler for jQuery

Here’s a small jQuery code snippet that you can use to have an easy to use checkbox toggler to enable or disable a TinyMCE editor with ease (tested on TinyMCE version 4 and jQuery version 2.1.1). It’s really easy to use. You just need to create a checkbox element with the class tiny_mce_toggler and a […]

, ,

How to create and configure EC2 instances for Rails hosting with CentOS using Ansible

Introduction In this quite extensive post I will walk you through the process of creating from scratch a box in EC2 ready to use for deploying your Rails app using Ansible. In the process I will show how to write a simple module that, while not necessary, will illustrate some points as well. Keep in […]

, , , , , , , , , , ,

Check progress of a mysql database import

If you’ve ever had to do a huge mysql import, you’ll probably understand the pain of not being able to know how long it will take to complete. At work we use the backup gem to store daily snapshots of our databases, the main one being several gigabytes in size. This gem basically does a […]

, ,

Create a temporary zip file to send as response in Rails

We have been doing a painful migration from Rails 2 to Rails 3 for several months at work, and refactoring some code the other day I had to do something in a non straightforward way, so I thought I’d share that. Basically we had an action that would group several files into a zip file […]

, ,

acts_as_list gem and single table inheritance in Rails

If you ever need to use the acts_as_list gem in Rails on a model that uses single table inheritance, here’s the snippet you need to use for the list methods to work if you want the setup done on the base model: acts_as_list :scope => [:type]acts_as_list :scope => [:type] You’ll need to use the array […]

, ,

Check_MK, software updates and mount options alarms

We have been using nagios (more specifically Check_MK) recently at work to get some monitoring information on our CentOS instances. Recently we decided to reprovision all of our EC2 instances to apply several security upgrades. Among the packages upgraded, there was the kernel (which I guess was the cause of our subsequent problems). After updating […]

, , , , ,

Capybara, pop up windows and the new PayPal sandbox

This past weeks we have been doing a massive refactoring of our testing suite at work to set up a nice CI server setup, proper factories, etc. Our tool-belt so far is basically a well known list of Rails gems: Factory Girl for factories. RSpec as a testing framework (although we’ll switch back to Test::Unit […]

, , ,

Fast and easy way to block bots from your website using Apache

Some weeks ago the site I work on started having severe outages. It looked like the system was not able to fulfill the incoming requests fast enough, making the passenger queue to grow faster than new requests could be served. Looking at the rails logs it looked like some Chinese bot was crawling the entire site, […]

,

Previous Posts