This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#convert backpack export into evernote import | |
require 'rubygems' | |
require 'hpricot' | |
require 'builder' | |
require 'time' | |
import_file = '/path/to/backpack-export.xml' | |
export_file = '/path/to/my_evernote_import.enex' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start = 0 | |
max = Resque.redis.llen(:failed).to_i | |
count = 100 | |
errors = [] | |
while start < max | |
Resque.list_range(:failed, start, count).each do |e| | |
errors << e if e['payload']['args'].first == 'User' | |
end | |
start += count | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'rubberband' | |
index = 'foo' | |
type = 'bar' | |
searcher = ElasticSearch.new("localhost:9200", :index => index, :type => type) | |
searcher.delete_index(index) rescue nil | |
searcher.create_index index | |
searcher.index({:name => 'foo'}) | |
searcher.refresh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XDELETE 'http://localhost:9200/foo' | |
curl -XPUT 'http://localhost:9200/foo' -d ' | |
{ | |
index: {} | |
} | |
' | |
curl -XPUT 'http://localhost:9200/foo/bar/123' -d ' | |
{ | |
name: "baz" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XDELETE 'http://localhost:9200/foo/bar' | |
curl -XPUT 'http://localhost:9200/foo/bar/123' -d ' | |
{ | |
name: "baz" | |
} | |
' | |
curl -XPOST 'http://localhost:9200/foo/_refresh' | |
curl -XGET 'http://localhost:9200/foo/bar/_search?q=baz&size=10' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XPUT localhost:9200/_percolator/elastic_searchable/myfilter -d '{ | |
query: { | |
query_string: { | |
query: "foo" | |
} | |
} | |
}' | |
curl -XPOST localhost:9200/_percolator/_refresh | |
curl -XPUT localhost:9200/elastic_searchable/books/1?percolate=* -d '{ | |
title: "foo bar" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XDELETE http://localhost:9200/test | |
curl -XPUT http://localhost:9200/test -d " | |
{\"analysis.analyzer.default.tokenizer\":\"standard\",\"mappings\":{\"users\":{\"properties\":{\"name\":{\"index\":\"not_analyzed\",\"type\":\"string\"}}}},\"analysis.analyzer.default.filter\":[\"standard\",\"lowercase\",\"porterStem\"]} | |
" | |
curl http://localhost:9200/test/_status | jsonpretty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# error in log output | |
# [2011-04-12 17:07:03,319][DEBUG][action.admin.indices.status] [Foster, Tom] [foo][2], node[-Dbau_mxSR2TtFDAsvncyQ], [P], s[INITIALIZING]: Failed to execute [org.elasticsearch.action.admin.indices.status.IndicesStatusRequest@2a2e0135] | |
# org.elasticsearch.index.IndexShardMissingException: [foo][2] missing | |
# at org.elasticsearch.index.service.InternalIndexService.shardSafe(InternalIndexService.java:165) | |
# at org.elasticsearch.action.admin.indices.status.TransportIndicesStatusAction.shardOperation(TransportIndicesStatusAction.java:148) | |
# at org.elasticsearch.action.admin.indices.status.TransportIndicesStatusAction.shardOperation(TransportIndicesStatusAction.java:57) | |
# at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction$AsyncBroadcastAction.performOperation(TransportBroadcastOperationAction.java:238) | |
# at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction$AsyncBroadcastAction.access$200(TransportBroadcastOperationA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cluster_name" : "elasticsearch", | |
"master_node" : "-Dbau_mxSR2TtFDAsvncyQ", | |
"blocks" : { | |
}, | |
"nodes" : { | |
"-Dbau_mxSR2TtFDAsvncyQ" : { | |
"name" : "Foster, Tom", | |
"transport_address" : "inet[/10.0.1.4:9300]", | |
"attributes" : { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'jslint' | |
# "var someJsExpresion = 'stuff';".should be_lintable | |
RSpec::Matchers.define :be_lintable do |expected| | |
match do |actual| | |
tmp_js_output_dir = Rails.root.join('tmp', 'js_lintable') | |
FileUtils.mkdir_p tmp_js_output_dir unless File.exists?(tmp_js_output_dir) | |
tmp_js_output = File.join(tmp_js_output_dir, 'output.js') |