This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.core.management.base import BaseCommand | |
| from qa.models import Question, Answer | |
| from lib.models import Liker, Tag | |
| import random | |
| #cd /Users/denis/track/env/lib/python2.7/site-packages/django && fgrep -lr "def " . | xargs -P8 -n1 cat | perl -lne '/^def (\w+)\(/ && print $1' >/tmp/all_django_funcs.txt | |
| with open('/tmp/all_django_funcs.txt', 'r') as f: | |
| all_django_funcs = f.read().splitlines() | |
| question_text_templates = ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.core.management.base import BaseCommand | |
| from qa.models import Question, Answer | |
| from lib.models import Liker, Tag | |
| import random | |
| #cd /Users/denis/track/env/lib/python2.7/site-packages/django && fgrep -lr "def " . | xargs -P8 -n1 cat | perl -lne '/^def (\w+)\(/ && print $1' >/tmp/all_django_funcs.txt | |
| with open('/tmp/all_django_funcs.txt', 'r') as f: | |
| all_django_funcs = f.read().splitlines() | |
| question_text_templates = ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 1. go to https://aws.amazon.com and launch t2.nano instance with Ubuntu 14.04, opening ports 11212 and 11211 in security group settings | |
| # 2. connect via ssh to it | |
| # 3. curl http://download.tarantool.org/tarantool/1.6/gpgkey | sudo apt-key add - | |
| # 4. run next commands for installation of tarantool (it's from http://tarantool.org/download.html) | |
| curl http://download.tarantool.org/tarantool/1.6/gpgkey | sudo apt-key add - | |
| release=`lsb_release -c -s` | |
| sudo rm -f /etc/apt/sources.list.d/*tarantool*.list | |
| sudo tee /etc/apt/sources.list.d/tarantool_1_6.list <<- EOF | |
| deb http://download.tarantool.org/tarantool/1.6/ubuntu/ $release main |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #app/settings.py | |
| INSTALLED_APPS = ( | |
| #... | |
| 'haystack', | |
| ) | |
| HAYSTACK_CONNECTIONS = { | |
| 'default': { | |
| 'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine', | |
| 'URL': 'http://127.0.0.1:9200/', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #define TOKENPASTE(x, y) x ## y | |
| #define TOKENPASTE2(x, y) TOKENPASTE(x, y) | |
| #define UNIQUE_FUNC_NAME TOKENPASTE2(cleanuper_func_, __LINE__) | |
| #define UNIQUE_VAR_NAME TOKENPASTE2(cleanuper_var_, __LINE__) | |
| #define SCOPE_EXIT(code_) \ | |
| void UNIQUE_FUNC_NAME(int *t __attribute__((unused))) \ | |
| code_ \ |
NewerOlder