Skip to content

Instantly share code, notes, and snippets.

View cristiangrojas's full-sized avatar

Cristian Rojas cristiangrojas

View GitHub Profile
@cristiangrojas
cristiangrojas / custom jquery ui autocomplete
Created October 11, 2012 18:55
I'm using this custom autocomplete for actualito.com
$(function(){
$.widget('custom.actualito_autocomplete', $.ui.autocomplete, {
_renderMenu: function(ul, items){
var that = this,
currencyCategory = '';
$.each(items, function(index, item){
if(item.type != currencyCategory){
ul.append( "<li class='ui-autocomplete-category list_item_container filter'>" + item.type + "</li>" );
currencyCategory = item.type;
}
Barebones Server Setup
Current Linux Distro: Ubuntu 10.04 LTS
###
Optional:
or UPDATE distro in /etc/apt/sources.list run apt-get update and apt-get dist-upgrade
###
1) ssh to fresh slice*
ssh root@173.255.240.209
http://samos-it.com/trying-to-install-scrapy-with-pip-lxml-error-command-gcc-failed-with-exit-status-1/
The solution
Install Python development package
sudo apt-get install python-dev
Install the development packages of libxml and libst
sudo apt-get install libxml2-dev
@cristiangrojas
cristiangrojas / Install redis ubuntu
Created April 22, 2013 18:31
how to setup redis on ubuntu
http://ijonas.com/software-development/nosql/412/
sudo apt-get update
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:pitti/postgresql
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
#!/bin/bash
#
# Install Postgres 9.1, PostGIS and create PostGIS template on a clean Ubuntu 11.10 Oneiric Ocelot box
# http://wildfish.com
# add the ubuntu gis ppa
sudo apt-get -y install python-software-properties
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
#Download and install XCode
#Install homebrew (package manager) IF INSTALLED: just update it
ruby -e "$(curl -fsSL https://gist.github.com/raw/323731/install_homebrew.rb)"
#Install git
brew install git
#IF LION
sudo vi /etc/paths and move /usr/local/bin to the top, cuz LION comes with a specific osx restricted PG.
When installing on mountain lion:
installation:
brew install postgresql --without-ossp-uuid
initd /usr/local/var/postgres
mkdir /var/pgsql_socket
chown <user> /var/pgsql_socket
edit /usr/local/var/postgres/postgresql.conf
set unix_socket_directory to /var/pgsql_socket
@cristiangrojas
cristiangrojas / to add the postgis template:
Created June 2, 2013 00:30
to add the postgis template:
to add the postgis template:
cd /usr/local/Cellar/postgis/2.0.0/share/postgis/
createdb -E UTF8 template_postgis
createlang -d template_postgis plpgsql
psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis';"
psql -d template_postgis -f postgis.sql
psql -d template_postgis -f spatial_ref_sys.sql
psql -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;"
psql -d template_postgis -c "GRANT ALL ON geography_columns TO PUBLIC;"
# Something in lines of http://stackoverflow.com/questions/348630/how-can-i-download-all-emails-with-attachments-from-gmail
# Make sure you have IMAP enabled in your gmail settings.
# Right now it won't download same file name twice even if their contents are different.
import email
import getpass, imaplib
import os
import sys
detach_dir = '.'