Skip to content

Instantly share code, notes, and snippets.

@defunkt
defunkt / clients.md
Created April 18, 2010 14:09
A list of Gist clients.

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support

@jeffrafter
jeffrafter / server.js
Created August 28, 2010 21:37
Twitter OAuth with node-oauth for node.js+express
var express = require('express');
var sys = require('sys');
var oauth = require('oauth');
var app = express.createServer();
var _twitterConsumerKey = "YOURTWITTERCONSUMERKEY";
var _twitterConsumerSecret = "YOURTWITTERCONSUMERSECRET";
function consumer() {
@clintongormley
clintongormley / gist:1016898
Created June 9, 2011 15:02
span_first query example
# [Thu Jun 9 17:00:23 2011] Protocol: http, Server: 192.168.5.103:9200
curl -XPUT 'http://127.0.0.1:9200/test/?pretty=1'
# [Thu Jun 9 17:00:23 2011] Response:
# {
# "ok" : true,
# "acknowledged" : true
# }
# [Thu Jun 9 17:00:31 2011] Protocol: http, Server: 192.168.5.103:9200
JavaScript Value JavaScript Type Java Type Is Scriptable Is Function
{a:1, b:['x','y']} object org.mozilla.javascript.NativeObject + -
[1,2,3] object org.mozilla.javascript.NativeArray + -
1 number java.lang.Double - -
1.2345 number java.lang.Double - -
NaN number java.lang.Double - -
Infinity number java.lang.Double - -
-Infinity number java.lang.Double - -
true boolean java.lang.Boolean -
-
@rajraj
rajraj / es.sh
Created January 3, 2012 20:07 — forked from aaronshaf/es.sh
Install ElasticSearch on CentOS 6
cd ~
sudo yum update
sudo yum install java-1.7.0-openjdk.i686 -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.9.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
@wtokuno
wtokuno / jackson.md
Created March 7, 2012 21:07
Jackson - JSON Processor

下書き

Jacksonとは

JacsonはJSON(JavaScript Object Notation)と呼ばれるデータ記述言語を扱うためのJavaライブラリ。

ウェブアプリケーション開発ではJSONが必須の技術になってきている。 JavaでJSONを扱うためのAPIがJava EE 7に含まれる予定。JSR 343として仕様策定中。

@jprante
jprante / BulkWrite.java
Created May 2, 2012 18:21
Performing multithreaded asynchronous bulk writes to Elasticsearch
/*
* Licensed to Jörg Prante and xbib under one or more contributor
* license agreements. See the NOTICE.txt file distributed with this work
* for additional information regarding copyright ownership.
*
* Copyright (C) 2012 Jörg Prante and xbib
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation; either version 3 of the License, or
@clintongormley
clintongormley / gist:3888120
Created October 14, 2012 09:44
Upgrading a running elasticsearch cluster

Yesterday I upgraded our running elasticsearch cluster on a site which serves a few million search requests a day, with zero downtime. I've been asked to describe the process, hence this blogpost.

To make it more complicated, the cluster was running elasticsearch version 0.17.8 (released 6 Oct 2011) and I upgraded it to the latest 0.19.10. There have been 21 releases between those two versions, with a lot of functional changes, so I needed to be ready to roll back if necessary.

Our setup:

  • elasticsearch

We run elasticsearch on two biggish boxes: 16 cores plus 32GB of RAM. All indices have 1 replica, so all data is stored on both boxes (about 45GB of data). The primary data for our main indices is also stored in our database. We have a few other indices whose data is stored only in elasticsearch, but are updated once daily only. Finally, we store our sessions in elasticsearch, but active sessions are cached in memcached.

componentについて

componentはWebアプリ向けのパッケージ管理システムです。 componentではGithubのリポジトリをパッケージとして扱います。

例えば、ボタンをクリックすると"Hello, world!"を表示するような簡単なアプリをかいてみます。

component createコマンドでプロジェクトを作成します。 今回はGithub上に配置する予定は無いので--localオプションをつけています。

$ component create --local hello-world
@KidA78
KidA78 / gist:5279210
Created March 31, 2013 02:19
Some code to help engineers mock Twitter4J using EasyMock
import java.util.ArrayList;
import java.util.List;
import org.easymock.EasyMock;
import org.easymock.IExpectationSetters;
import org.json.JSONArray;
import org.json.JSONObject;
import twitter4j.Paging;
import twitter4j.RateLimitStatus;