Skip to content

Instantly share code, notes, and snippets.

View fabien7337's full-sized avatar

Fabien fabien7337

  • Nanoly
  • Paris
View GitHub Profile
@fabien7337
fabien7337 / Nginx SSL
Last active February 12, 2016 15:13
sudo git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
sudo service nginx stop
cd /opt/letsencrypt
./letsencrypt-auto certonly --standalone -d example.com -d www.example.com
# In Nginx conf file
ssl on;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
@fabien7337
fabien7337 / gist:fe0e60ff20739f33a447
Last active August 29, 2015 14:25
Sublime Text Configuration File
{
"always_show_minimap_viewport": true,
"auto_match_enabled": false,
"bold_folder_labels": true,
"caret_style": "phase",
"color_scheme": "Packages/Theme - Afterglow/Afterglow.tmTheme",
"font_size": 12,
"highlight_line": true,
"folder_exclude_patterns": [".capistrano", ".git", ".sass-cache", "log", "tmp"],
"ignored_packages":
@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
git reset --hard origin/master
git push origin staging --force
@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
--####################################################################
@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 / 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: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: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: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"
}
}