Skip to content

Instantly share code, notes, and snippets.

@karmi
karmi / git-hosting-apache.conf
Created July 21, 2010 07:43
Configuration for hosting Git repositories with Apache 2.x
# ----------------------------------------------------------
# Configuration for hosting Git repositories with Apache 2.x
# ----------------------------------------------------------
#
# This setup provides "dual URLS", where URL like <http://git.example.com/my_repository.git>
# loads Gitweb in the browser and the same URL can be used in commands like `git clone` and `git remote add`.
# It was compiled from some sources on the internet and further customized/tuned.
#
# Please see documentation for:
#
@karmi
karmi / movie-titles.rb
Created January 13, 2013 20:42
Multiple analyzers and query fields in Elasticsearch for auto-completion
require 'tire'
# Tire.configure { logger STDERR, level: 'debug' }
Tire.index('movie-titles') do
delete
create \
settings: {
index: {
analysis: {
@karmi
karmi / facebook-messages-search.rb
Created September 12, 2011 15:32
Simplified model of Facebook's Message Inbox Search with HBase
# --------------------------------------------------------------
# Simplified model of Facebook's Message Inbox Search with HBase
# --------------------------------------------------------------
#
# Facebook exploits versioning support in HBase with a very interesting twist:
# it stores message IDs for given token as “custom timestamps” in the database.
#
# The [HBase: The Definitive Guide](http://ofps.oreilly.com/titles/9781449396107/advanced.html#advsearch) book says (p. 385):
#
# > A prominent implementation of a client managed solution is the Facebook inbox search. The schema is built roughly like this:
@karmi
karmi / hbase-rest-examples.sh
Created September 15, 2011 09:53
Experiments with the HBase REST API
#!/usr/bin/env bash
#
# ===================================
# Experiments with the HBase REST API
# ===================================
#
# <http://hbase.apache.org/docs/r0.20.4/api/org/apache/hadoop/hbase/rest/package-summary.html>
#
# Usage:
#
@karmi
karmi / tophashes-sliding-window-redis.sh
Created December 7, 2010 10:06
Desigining "trending topics in 24 hours sliding window" with Redis
# ------------------------------------------------------------------
# Desigining "trending topics in 24 hours sliding window" with Redis
# ------------------------------------------------------------------
redis-cli del tophashes:2010-12-07-08-00
redis-cli del tophashes:2010-12-07-09-00
redis-cli del tophashes:current
echo '=== 8:00 AM ==='
@karmi
karmi / elastic_search_ngram_analyzer_for_urls.sh
Created May 24, 2011 15:32
NGram Analyzer in ElasticSearch
# ========================================
# Testing n-gram analysis in ElasticSearch
# ========================================
curl -X DELETE localhost:9200/ngram_test
curl -X PUT localhost:9200/ngram_test -d '
{
"settings" : {
"index" : {
"analysis" : {
@karmi
karmi / .gitignore
Created June 3, 2010 10:57
Code for Rack middleware talks
.DS_Store
*.log
@karmi
karmi / .gitignore
Last active November 12, 2022 12:11
Example Nginx configurations for Elasticsearch (https://www.elastic.co/blog/playing-http-tricks-nginx)
nginx/
!nginx/.gitkeep
!nginx/logs/.gitkeep
src/
tmp/
@karmi
karmi / .gitignore
Created March 17, 2012 14:53
ElasticSearch bootstrap script and node configuration for Ubuntu [https://gist.github.com/2050769]
.DS_Store
Gemfile.lock
*.pem
node.json
tmp/*
!tmp/.gitignore
@karmi
karmi / .gitignore
Created March 16, 2012 16:09
Bootstrap, install and configure ElasticSearch with Chef Solo
.DS_Store
Gemfile.lock
*.pem
node.json
tmp/*
!tmp/.gitignore