Skip to content

Instantly share code, notes, and snippets.

rgaidot / gist:792451
Created Jan 23, 2011
Entity Extraction using NLTK
View gist:792451
import nltk
text = """Barack Hussein Obama II (born August 4, 1961) is the 44th and current President of the United States. He is the first African American to hold the office. Obama previously served as a United States Senator from Illinois, from January 2005 until he resigned after his election to the presidency in November 2008."""
sentences = nltk.sent_tokenize(text)
tokenized_sentences = [nltk.word_tokenize(sentence) for sentence in sentences]
tagged_sentences = [nltk.pos_tag(sentence) for sentence in tokenized_sentences]
chunked_sentences = nltk.batch_ne_chunk(tagged_sentences, binary=True)
def extract_entity_names(t):
View lastfm-very-simple-recommender.rb
# This script just get the latest tracks of your friends on and recommends those more popular.
# It's all based on a conversation between @mort, @rochgs, @littlemove and me (mainly by @mort)
# 1. Install lastfm gem:
# gem install lastfm
# 2. Get a API Key on
require 'lastfm'
rgaidot / elasticoverflow.rb
Created May 4, 2011 — forked from karmi/elasticoverflow.rb
Importing and searching RSS with ElasticSearch and Tire
View elasticoverflow.rb
# =======================================================
# Importing and searching RSS with ElasticSearch and Tire
# =======================================================
# This script downloads, parses and indexes Stackoverflow RSS feed with ElasticSearch
# via the [Tire]( Rubygem.
# Requirements
# ------------
View simple-rails-template.rb
# Simple Rails Template
# e.g: rails new myapp -d mysql -m http://.../simple-rails-template.rb
# Enjoy !
# ~ @rgaidot
rgaidot / sinatra-memcacher.rb
Created Apr 4, 2012 — forked from mralex/sinatra-memcacher.rb
Simple memcached helper for Sinatra.
View sinatra-memcacher.rb
# Activate in a modular Sinatra app:
# register Sinatra::Memcacher
# set :memcacher_enabled, true
# set :memcacher_expiry, 86400
# Cache an action:
# get '/' do
# cache "index" do
rgaidot /
Created Sep 15, 2012 — forked from josevalim/
Sinatra like routes in Rails controllers

Sinatra like routes in Rails controllers

A proof of concept of having Sinatra like routes inside your controllers.

How to use

Since the router is gone, feel free to remove config/routes.rb. Then add the file below to lib/action_controller/inline_routes.rb inside your app.

View gist:5403026
(($) ->
$.instagramPictures = (el, options) ->
base = this
base.$el = $(el)
base.el = el = {}
base.$ "instagramPictures", base
base.init = ->
base.options = $.extend({}, $.instagramPictures.defaultOptions, options)
alert "The jQuery Instagram plugin need an access token" if typeof (base.options.accessToken) is "undefined" or base.options.accessToken is null
# cpustatus
# Prints the current state of the CPU like temperature, voltage and speed.
# The temperature is reported in degrees Celsius (C) while
# the CPU speed is calculated in megahertz (MHz).
function convert_to_MHz {
let value=$1/1000
echo "$value"
rgaidot / Gemfile
Created Feb 16, 2014
Ruby on Rails Lightweight
View Gemfile
source :rubygems
gem "actionpack", "~> 4.0"
gem "railties", "~> 4.0"
gem "tzinfo"
gem "thin"
kill -9 `ps ax | grep "$1" | awk '{print $1}'` &2>/dev/null
echo "byebye $1 :-)"
You can’t perform that action at this time.