Skip to content

Instantly share code, notes, and snippets.

@barseghyanartur
barseghyanartur / pgpass_helper.py
Created July 29, 2015 11:52
The Password File helper script for PostgreSQL to be used in Django
from __future__ import print_function
__all__ = ('read_pgpass',)
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
def read_pgpass(dbname):
"""
@barseghyanartur
barseghyanartur / currency_helper.py
Last active August 29, 2015 14:26
Get all currencies in a dict or a list
__all__ = (
'ALL_CURRENCIES', 'ALL_CURRENCIES_LIST', 'ALLOWED_CURRENCIES',
'CURRENCIES', 'CURRENCIES_LIST',
)
from pycountry import currencies
# Getting a list of all currencies to be used in Django
ALL_CURRENCIES = {c.letter: c.name for c in list(currencies)}
ALL_CURRENCIES_LIST = sorted(list(ALL_CURRENCIES.items()), key=lambda i: i[0])
@barseghyanartur
barseghyanartur / multiple_ssh_setting.md
Last active August 29, 2015 14:27 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@barseghyanartur
barseghyanartur / gist:b7e85802efdfec683456
Created October 9, 2015 13:26
Genymotion installation instructions on Ubuntu
https://cloud.genymotion.com/page/launchpad/download/
Download one
Move the downloaded file to ~/
mv genymotion-2.5.2_x64_debian.bin ~/
chmod +x ./genymotion-2.5.2_x64_debian.bin
@barseghyanartur
barseghyanartur / gist:b407148d06b973158382
Created October 13, 2015 07:19 — forked from AliMD/gist:3344523
All github Emoji (Smiles)

All github Emoji (Smiles)

ali.md/emoji

:bowtie: | 😄 | 😆 | 😊 | 😃 | ☺️ | 😏 | 😍 | 😘 | :kissing_face: | 😳 | 😌 | 😆 | 😁 | 😉 | :wink2: | 👅 | 😒 | 😅 | 😓

😩 | 😔 | 😞 | 😖 | 😨 | 😰 | 😣 | 😢 | 😭 | 😂 | 😲 | 😱 | :neckbeard: | 😫 | 😠 | 😡 | 😤 | 😪 | 😋 | 😷

😎 | 😵 | 👿 | 😈 | 😐 | 😶 | 😇 | 👽 | 💛 | 💙 | 💜 | ❤️ | 💚 | 💔 | 💓 | 💗 | 💕 | 💞 | 💘 | ✨

@barseghyanartur
barseghyanartur / install-xapian.sh
Last active May 2, 2019 10:20 — forked from areski/install-xapian
Install xapian Core and Bindings with Python support on Ubuntu 14.04 LTS
# *****************************************************
# ***************** Install xapian Core ***************
# *****************************************************
sudo apt-get install zlib1g-dev
sudo apt-get install g++
sudo apt-get install uuid-dev
curl -O http://oligarchy.co.uk/xapian/1.2.18/xapian-core-1.2.18.tar.xz
curl -O http://oligarchy.co.uk/xapian/1.2.18/xapian-bindings-1.2.18.tar.xz
# -*- coding: utf-8 -*-
"""
Search features for :
* :mod:`elasticsearch.elasticsearch`
* :mod:`haystack:haystack`
* :mod:`elasticstack:elasticstack`
:creationdate: 05/11/15 15:05
:moduleauthor: François GUÉRIN <fguerin@ville-tourcoing.fr>
@barseghyanartur
barseghyanartur / clean_media.py
Last active November 24, 2017 18:09
Clean media by deleting those files which are no more referenced by any FileField (django command)
# -*- coding: utf-8 -*-
import os
import sys
from six.moves import input
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.apps import apps
@barseghyanartur
barseghyanartur / httpie.sh
Created April 11, 2016 13:00 — forked from chris-rock/httpie.sh
Httpie Quick Install Ubuntu 14.04
apt-get update && apt-get install -y curl && curl --silent https://bootstrap.pypa.io/get-pip.py |python3 && pip install --upgrade httpie
@barseghyanartur
barseghyanartur / README.txt
Created May 11, 2016 09:20 — forked from mattweber/README.txt
ElasticSearch Multi-Select Faceting Example
This is an example how to perform multi-select faceting in ElasticSearch.
Selecting multiple values from the same facet will result in an OR filter between each of the values:
(facet1.value1 OR facet1.value2)
Faceting on more than one facet will result in an AND filter between each facet:
(facet1.value1 OR facet1.value2) AND (facet2.value1)
I have chosen to update the counts for each facet the selected value DOES NOT belong to since we are performing an AND between each facet. I have included an example that shows how to keep the counts if you don't want to do this (filter0.sh).