Skip to content

Instantly share code, notes, and snippets.

@LolWalid
LolWalid / complex_condition.md
Last active October 17, 2019 21:22
ElasticSearch queries

where (condition1 && condition2) || (condition3 && condition4)

Example: where (place.type = 'Restaurant' and place.kind = 'Chinese') or (place.type = 'Bar' and place.kind in ('beer','wine'))

{
  query: {
    bool: {
      should: [
        {

bool: {

@LolWalid
LolWalid / git_prune.md
Created June 23, 2017 11:30
Remove merged branch locally

Remove branch that are no longer being referenced

git remote prune origin

Remove merged branch

git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d

{
"detect_indentation": false,
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"folder_exclude_patterns":
[
".svn",
".git",
".hg",
"CVS",
@yannvery
yannvery / How_to_maintain_fork_sync.md
Created January 20, 2016 09:52
How to maintain fork sync

How to maintain fork sync

Configuring a remote for a fork

To sync changes you make in a fork with the original repository, you must configure a remote that points to the upstream repository in Git.

  • Open a Terminal
  • List current configured remote repository for your fork
git remote -v
origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
@tadast
tadast / ssl_puma.sh
Last active January 29, 2024 04:41 — forked from trcarden/gist:3295935
localhost SSL with puma
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key