Skip to content

Instantly share code, notes, and snippets.

View fabien7337's full-sized avatar

Fabien fabien7337

  • Nanoly
  • Paris
View GitHub Profile
@fabien7337
fabien7337 / gist:5642329
Created May 24, 2013 09:16
bundle update & rspec spec for Dynamoid
Dynamoid git:(master) ✗ bundle update
Fetching gem metadata from http://rubygems.org/.......
Fetching gem metadata from http://rubygems.org/..
Resolving dependencies...
Using rake (10.0.4)
Using i18n (0.6.1)
Using multi_json (1.7.3)
Using activesupport (3.2.13)
Using builder (3.0.4)
Using activemodel (3.2.13)
@fabien7337
fabien7337 / gist:6581246
Last active December 23, 2015 04:39
Example of terms stats with my data
{
:id=>"---qlK1dgRw",
:channel_id=>"UC5DRS1AfES0hVY8eBRUqlrA",
:title=>"Farcry 2 w/ Kootra Ep. 13 \"Scrapyard\"",
:description=>
"Remember to send over a like and such, it helps the cats hunting for the Jackal.....he is clever.\n\nHere I am playing through Farcry 2 in preparation for Farcry 3. I have played through this game at least 10 times on xbox, including Infamous difficulty. So this should be good.",
:views_count=>38320,
:likes_count=>944,
:dislikes_count=>4,
:comments_count=>240,
@fabien7337
fabien7337 / gist:6581303
Created September 16, 2013 14:19
With multiple terms stats
curl -X GET '127.0.0.1:9200/videos/video/_search?from=0&size=20&pretty' -d '{
"query":{
"bool":{
"must":[
{
"query_string":{
"query":"*",
"default_operator":"AND"
}
}
@fabien7337
fabien7337 / gist:6581373
Last active December 23, 2015 04:39
Multiple value in a terms stats
curl -X GET '127.0.0.1:9200/octoly-development-videos/video/_search?from=0&size=20&pretty' -d '{
"query":{
"bool":{
"must":[
{
"query_string":{
"query":"*",
"default_operator":"AND"
}
}
@fabien7337
fabien7337 / gist:6612106
Created September 18, 2013 16:55
ES Cluster Health Status
curl -XGET 'http://localhost:9200/_cluster/health?pretty=true'
{
"cluster_name" : "octoly-elasticsearch",
"status" : "green",
"timed_out" : false,
"number_of_nodes" : 6,
"number_of_data_nodes" : 6,
"active_primary_shards" : 50,
"active_shards" : 280,
"relocating_shards" : 0,
@fabien7337
fabien7337 / gist:6670041
Created September 23, 2013 12:57
Field data
curl localhost:9200/_stats/fielddata/*?pretty
{
"ok" : true,
"_shards" : {
"total" : 280,
"successful" : 280,
"failed" : 0
},
"_all" : {
@fabien7337
fabien7337 / gist:8043859
Created December 19, 2013 18:26
Git Branch/Rebase Workflow
git co master
git pull
git co -b new_branch_for_task
git add modified_files
git ci -m "adding new feature"
git fetch origin
git rebase origin/master
git co master
git pull
git rebase new_branch_for_task
@fabien7337
fabien7337 / exportDynamoDBTableToS3.hql
Last active August 29, 2015 13:58
exportDynamoDBTableToS3
--####################################################################
--# Export schema-less table from DDB to S3
--#
--# Params:
--# DYNAMODB_INPUT_TABLE - name of input table
--# S3_OUTPUT_BUCKET - output bucket s3 path
--# DYNAMODB_READ_PERCENT - percent of table RCU to use
--# DYNAMODB_ENDPOINT - dynamodb service endpoint to use
--####################################################################
git reset --hard origin/master
git push origin staging --force
@fabien7337
fabien7337 / compare_lines.sh
Last active August 29, 2015 14:07
Useful to compare a file line by line: for example to extract lines that are in file1 but not in file2
#!/bin/sh
while read line_file1
do
answered=$(cat file2| grep $line_file1)
if [ -z "$answered" ]; then
echo $line_file1
fi
done < file1