Skip to content

Instantly share code, notes, and snippets.

View bvandreunen's full-sized avatar

Bastiaan van Dreunen bvandreunen

View GitHub Profile
@btoews
btoews / github_keychain.sh
Created August 14, 2015 18:43
Store GitHub access token in keychain
#!/bin/bash
echo -n "GitHub username: "
read username
echo -n "GitHub personal access token: "
read token
echo "Storing GitHub access token in keychain."
security add-generic-password -s github_access_token -a $username -w $token
@dsabanin
dsabanin / deploy.sh
Last active August 29, 2015 14:07
Tiny capistrano-like script for dploy.io
# Execute as ./deploy.sh /data/project 19851203123502
# It will deploy final release as a symlink from /data/project/current to /data/project/releases/19851203123502
BASE=$1
TIMESTAMP=$2
RELEASE=$BASE/releases/$TIMESTAMP
mkdir -p $BASE/releases $BASE/shared $BASE/logs
cp -al $BASE/deploy-cache $RELEASE
@bdecarne
bdecarne / query
Created July 19, 2013 12:17
Get an ElasticSearch facet based on id with label
{
"query" : { "query_string" : {"query" : "*"} },
"facets" : {
"tag" : {
"terms" : {
"field" : "id",
"script" : "term + \"|\" + _source.nom"
}
}
}
@clintongormley
clintongormley / gist:4095280
Created November 17, 2012 12:00
Using synonyms in Elasticsearch

We create an index with:

  • two filters: synonyms_expand and synonyms_contract
  • two analyzers: synonyms_expand and synonyms_contract
  • three text fields:
    • text_1 uses the synonyms_expand analyzer at index and search time
    • text_2 uses the synonyms_expand analyzer at index time, but the standard analyzer at search time
    • text_3 uses the synonyms_contract analyzer at index and search time

.