Skip to content

Instantly share code, notes, and snippets.

View FernandoEscher's full-sized avatar
🏠
Working from home

Fernando Irias Escher FernandoEscher

🏠
Working from home
  • Tegucigalpa, Honduras
View GitHub Profile
@FernandoEscher
FernandoEscher / abcde_rename.sh
Created September 5, 2012 19:10
Renaming the folders generated by abcde CD ripper
#!/bin/bash
SEPARATOR="-"
DIRS="${PWD}/*"
for dir in $DIRS
do
if [[ -d $dir && $dir == *-* ]]
then
dirname=$(basename $dir)
@FernandoEscher
FernandoEscher / config.rb
Created July 6, 2012 04:14
Configuration file for backups of Ppostgresql to Dropbox.
# encoding: utf-8
##
# Backup
# Generated Main Config Template
#
# For more information:
#
# View the Git repository at https://github.com/meskyanichi/backup
# View the Wiki/Documentation at https://github.com/meskyanichi/backup/wiki
@FernandoEscher
FernandoEscher / my_backup.rb
Created July 6, 2012 04:13
Backup file for the backup of Postgresql to Dropbox account
# encoding: utf-8
##
# Backup Generated: my_backup
# Once configured, you can run the backup with the following command:
#
# $ backup perform -t my_backup [-c <path_to_configuration_file>]
#
@FernandoEscher
FernandoEscher / nginx
Created June 25, 2012 21:56 — forked from jordanorelli/nginx
nginx init.d script
#!/usr/bin/env bash
# Adapted from the book "Nginx HTTP Server", by Clement Nedelcu.
# Original Author: Ryuan Norbauer http://norbauerinc.com
# Modified: Geoffrey Grosenbach http://topfunky.com
# Modified: Clement Nedelcu http://cnedelcu.blogspot.com/
# Modified: Jordan Orelli http://jordanorelli.com/
# source: https://gist.github.com/1161075
# Corresponds with the following compile-time options:
@FernandoEscher
FernandoEscher / Nginx-PassengerServerDirective
Created June 20, 2012 16:16
Directive to work with applications using Passenger, Nginx and RVM
server {
listen 80;
server_name juegoaprendo.hn www.juegoaprendo.hn ccepreb.hn www.ccepreb.hn ccepreb.fernandoirias.com;
root /opt/projects/ccepreb/current/public; # <--- be sure to point to 'public'!
passenger_enabled on;
client_max_body_size 50M;
}
@FernandoEscher
FernandoEscher / deploy.rb
Created June 20, 2012 14:03
Capistrano deployment script
set :rvm_ruby_string, '1.9.3-p0@ccepreb'
set :rvm_install_type, :stable
set :rvm_install_ruby, :install
require "rvm/capistrano"
# server details
default_run_options[:pty] = true
set :application, "your_app"
server "ip_or_domain", :app, :web, :db, :primary => true
@FernandoEscher
FernandoEscher / gist:2727188
Created May 18, 2012 19:25
Kill Nginx process
You should not to restart nginx after applying new configuration.
ps aux | egrep '(PID|nginx)'
and kill the PID
kill -HUP PID
@FernandoEscher
FernandoEscher / gist:2691561
Created May 14, 2012 03:10
Configuración de Postgresql para Rails
# Install latest version of postgresql
sudo apt-get install postgresql
# Access the console with the postgres role to the postgres database
sudo -u postgres psql postgres
# Create rol YourAppName
create role YourAppName with createdb login password 'YourAppRolePassword';
# Verify that the rol has been created
@FernandoEscher
FernandoEscher / JSONResponseHandler.java
Created November 26, 2011 09:53
Android JSONResponseHandler
public class JSONResponseHandler implements ResponseHandler<Object>{
final static String TAG = "JSONResponseHandler";
@Override
public Object handleResponse(HttpResponse response)
throws HttpResponseException, IOException {
StatusLine statusLine = response.getStatusLine();
HttpEntity entity = response.getEntity();
@FernandoEscher
FernandoEscher / gist:810594
Created February 4, 2011 01:38
Conteo de mensajes por cada usuario
from django.contrib.auth.models import User
from django.db.models import Count
ul = User.objects.annotate(Count('_message_set'))
for u in ul:
print '%s: %s'%(u.username, u._message_set__count)