Skip to content

Instantly share code, notes, and snippets.

hqlgree2 gree2

Block or report user

Report or block gree2

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gree2
gree2 / elasticsearch-term-frequency.sh
Created Jun 23, 2017 — forked from nz/elasticsearch-term-frequency.sh
In Elasticsearch, how do I get a list of the top 10 most frequently occurring values of a field?
View elasticsearch-term-frequency.sh
#!/bin/sh
test_document="{
\"text\": \"HEAR the sledges with the bells, / Silver bells! / What a world of merriment their melody foretells! / How they tinkle, tinkle, tinkle, / In the icy air of night! / While the stars, that oversprinkle / All the heavens, seem to twinkle / With a crystalline delight; / Keeping time, time, time, / In a sort of Runic rhyme, / To the tintinnabulation that so musically wells / From the bells, bells, bells, bells, / Bells, bells, bells— / From the jingling and the tinkling of the bells.\"
}"
if curl -fs -X HEAD localhost:9200/top-terms; then
echo "Clear the old test index"
curl -X DELETE localhost:9200/top-terms; echo "\n"
fi
View setup
##########
# For verification, you can display the OS release.
##########
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=11.10
DISTRIB_CODENAME=oneiric
DISTRIB_DESCRIPTION="Ubuntu 11.10"
##########
@gree2
gree2 / SuperPomMarven2.1.txt
Created Aug 11, 2012
Super POM: Marven 2.1
View SuperPomMarven2.1.txt
<project>
<modelVersion>4.0.0</modelVersion>
<name>Maven Default Project</name>
<repositories>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>http://repo1.maven.org/maven2</url>
@gree2
gree2 / SuperPomMaven2.0.txt
Created Aug 11, 2012
Super POM: Maven 2.0
View SuperPomMaven2.0.txt
<project>
<modelVersion>4.0.0</modelVersion>
<name>Maven Default Project</name>
<repositories>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>http://repo1.maven.org/maven2</url>
@gree2
gree2 / conf-multi-node.txt
Created Aug 5, 2012
Install Hadoop: conf-multi-node
View conf-multi-node.txt
<!-- In: conf/core-site.xml -->
<property>
<name>fs.default.name</name>
<value>hdfs://master:54310</value>
<description>...</description>
</property>
<!-- In: conf/mapred-site.xml -->
<property>
@gree2
gree2 / conf-single-node.txt
Created Aug 5, 2012
Install Hadoop: conf-single-node
View conf-single-node.txt
#Add to the end of the ~/.bashrc
# Set Hadoop-related environment variables
export HADOOP_HOME=/usr/local/hadoop
# Set JAVA_HOME (we will also configure JAVA_HOME directly for Hadoop later on)
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386
# Some convenient aliases and functions for running Hadoop-related commands
unalias fs &> /dev/null
alias fs="hadoop fs"
unalias hls &> /dev/null
alias hls="fs -ls"
@gree2
gree2 / CmpMssqlDb.py
Created Aug 3, 2012
Python: CmpMssqlDb
View CmpMssqlDb.py
import sqlite3
import pymssql
db1Conn = ['127.0.0.1', 'sa', 'sa','AuditDataCenter']
db2Conn = ['127.0.0.1', 'sa', 'sa','AuditDataCenter1']
sql = "SELECT * from INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'"
def MssqlTables(dbConn):
conn = pymssql.connect(host=dbConn[0], user=dbConn[1], password=dbConn[2], database=dbConn[3])
@gree2
gree2 / PPMConverter.py
Created Aug 3, 2012
Python: PPMConverter
View PPMConverter.py
import os, sys
import Image
ppmDir = "ppm/"
jpfDir = "jpg/"
for filename in os.listdir(ppmDir):
(name, ext) = os.path.splitext(filename)
if ".ppm" != ext:
continue
@gree2
gree2 / Convert2Xaml.py
Created Aug 3, 2012
Python: Convert2Xaml
View Convert2Xaml.py
import re
import os
from lxml import etree
from copy import deepcopy
fileInput = "Input.xml"
fileOutput = "Output.xml"
def Indent(elem, level=0):
i = "\n" + level * " "
You can’t perform that action at this time.