type below:
brew update
brew install redis
To have launchd start redis now and restart at login:
brew services start redis
s = str(input()) | |
l = len(s)-1 | |
c = 1 | |
t = '' | |
if len(s) == 1: | |
t = t + s +str(c) | |
else: | |
for i in range(0,l): | |
if s[i] == s[i+1]: | |
c += 1 |
CREATE or REPLACE FUNCTION find_remoteness_btw_cords(lat1 double precision, lng1 double precision, lat2 double precision, lng2 double precision) | |
RETURNS double precision | |
LANGUAGE plpgsql AS $$ | |
BEGIN | |
RETURN ACOS(SIN(PI()*lat1/180.0)*SIN(PI()*lat2/180.0)+COS(PI()*lat1/180.0)*COS(PI()*lat2/180.0)*COS(PI()*lng2/180.0-PI()*lng1/180.0))*6367000; | |
END; | |
$$; | |
class ImageListView(ListView): | |
model = Image | |
template_name = "main/image_list.html" | |
paginate_by = 10 | |
def get_context_data(self, **kwargs): | |
context = super(ImageListView, self).get_context_data(**kwargs) | |
image_list = Image.objects.all() | |
paginator = Paginator(image_list, self.paginate_by) |
{% if is_paginated %} | |
<ul class="pagination"> | |
{% if page.has_previous %} | |
<li> | |
<span><a href="?page={{ page.previous_page_number }}">Previous</a></span> | |
</li> | |
{% endif %} | |
<li class=""> | |
<span>Page {{ page.number }} of {{ page.paginator.num_pages }}.</span> | |
</li> |
class RealtyObjectAdmin(admin.ModelAdmin): | |
list_display = ['realty_complex', | |
'square', 'rent_available', | |
'floor', 'flat_number', 'rent_price_eur'] | |
search_fields = ['realty_complex', ] | |
autocomplete_fields = ('realty_complex', ) | |
fieldsets = ( | |
(None, { | |
'fields': (('realty_complex', 'created_at', 'photo', ), |
SELECT | |
* | |
FROM profiles_courier | |
LEFT JOIN (SELECT ---- ДЖойним заказы с выручкой/предоплатой за последние 7 дней исключая now() - 1 day | |
courier_id, | |
count(orders.id) cashorders, -- Всего заказов | |
sum(declared_value) cashsum, -- Общая сумма | |
max(declared_value) maxcash -- Максимальная сумма в 1 заказе |
type below:
brew update
brew install redis
To have launchd start redis now and restart at login:
brew services start redis
#!/usr/bin/env bash | |
# | |
# Get the value of a tag for a running EC2 instance. | |
# | |
# This can be useful within bootstrapping scripts ("user-data"). | |
# | |
# Note the EC3 instance needs to have an IAM role that lets it read tags. The policy | |
# JSON for this looks like: | |
# | |
# { |