This file contains 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
import json | |
import redis | |
import time | |
import tornado | |
import tornadoredis | |
class BaseHandler(object): | |
def __init__(self, client, socketHandler, *args, **kwargs): | |
self.client = client |
This file contains 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
# -*- coding: utf-8 -*- | |
from hashlib import md5 | |
from urllib import urlencode | |
from django.conf import settings | |
_ADDRESS = 'https://auth.robokassa.ru/Merchant/Index.aspx?' | |
_EXTRA_PARAMS_PREFIX = 'shp_' | |
_COST = settings.CARDBOARD_COST |
This file contains 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 the Google API console, you need to activate the Analytics API, | |
and finally setup a Service Account, you'll then download a *.p12 file. | |
From this *.p12 file, you need to convert it to a *.pem file, to do that, run the following: | |
openssl pkcs12 -in XXXXX.p12 -nocerts -nodes -out XXXXX.pem | |
You'll be asked a password, it should be notasecret | |
Now you got the *.pem file you need, and the account email is the one displayed in the google api console, as EMAIL ADDRESS. | |
Don't forget to add this address to your analytics account | |
(see: Analytics Google API Error 403: "User does not have any Google Analytics Account") | |
You should be good to go with the following snippet: |
This file contains 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
function importContact (phone, firstName, lastName) { | |
return MtpApiManager.invokeApi('contacts.importContacts', { | |
contacts: [{ | |
_: 'inputPhoneContact', | |
client_id: '1', | |
phone: phone, | |
first_name: firstName, | |
last_name: lastName, | |
}], | |
replace: false, |
This file has been truncated, but you can view the full file.
This file contains 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
{"key":"I. Народное хозяйство","values":[{"key":"I. Народное хозяйство","values":[{"key":"I. Народное хозяйство","values":[{"key":"I. Народное хозяйство","values":[{"key":"1937","values":[{"name":"I. Народное хозяйство","year":"1937","union_budget":37026,"resp_budgets":2307.9,"local_budgets":4079.2,"total_budget":43413.1,"level":"I. Народное хозяйство","subLevel":"I. Народное хозяйство","subSubLevel":"I. Народное хозяйство"}]},{"key":"1938","values":[{"name":"I. Народное хозяйство","year":"1938","union_budget":44629.3,"resp_budgets":2423.1,"local_budgets":4671.2,"total_budget":51723.6,"level":"I. Народное хозяйство","subLevel":"I. Народное хозяйство","subSubLevel":"I. Народное хозяйство"}]},{"key":"1939","values":[{"name":"I. Народное хозяйство","year":"1939","union_budget":51513.4,"resp_budgets":3842.2,"local_budgets":5060.9,"total_budget":60416.5,"level":"I. Народное хозяйство","subLevel":"I. Народное хозяйство","subSubLevel":"I. Народное хозяйство"}]},{"key":"1940","values":[{"name":"I. Народное хозяйство" |
This file contains 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
LOGGING = { | |
"version": 1, | |
"disable_existing_loggers": False, | |
"filters": { | |
"require_debug_false": { | |
"()": "django.utils.log.RequireDebugFalse" | |
} | |
}, | |
"handlers": { | |
"mail_admins": { |
This file contains 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.urlresolvers import reverse | |
from django.utils.text import mark_safe | |
def add_link_field_to_related(target_model=None, field='', app='', field_name='link', | |
link_text=unicode): | |
def add_link(cls): | |
reverse_name = target_model or cls.model.__name__.lower() | |
def link(self, instance): |
This file contains 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
SET FOREIGN_KEY_CHECKS = 0; | |
SET @tables = NULL; | |
SELECT GROUP_CONCAT(table_schema, '.', table_name) INTO @tables | |
FROM information_schema.tables | |
WHERE table_schema = 'DB_NAME'; | |
SET @tables = CONCAT('DROP TABLE ', @tables); | |
PREPARE stmt FROM @tables; | |
EXECUTE stmt; | |
DEALLOCATE PREPARE stmt; |
This file contains 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
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals | |
from django.db import models, migrations | |
def make_balance_nullable_forwards(apps, schema_editor): | |
Carrier = apps.get_model("carriers", "Carrier") | |
default_balance_carriers = Carrier.objects.filter(balance=0) | |
default_deposit_carriers = Carrier.objects.filter(deposit=0) |
This file contains 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
{-# LANGUAGE DataKinds, TypeOperators #-} | |
{-# LANGUAGE TypeFamilies, FlexibleInstances, FlexibleContexts, ScopedTypeVariables | |
#-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE InstanceSigs #-} | |
module Router where | |
import Control.Applicative | |
import Control.Monad |
OlderNewer