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-*- | |
import urllib2 | |
import json | |
from datetime import date, datetime | |
import time | |
from time import gmtime, strftime | |
today = date.today() | |
vk_api_url = "https://api.vk.com/method/stats.get?group_id=33006648&app_id=3572991&date_from=%s&access_token=ef57857451d5a0b30cee5f6b3cb341ba27197ab9cba7a88a3591099afb4a5d9fa345be40cbe3dc9e153cb"%today | |
dataStoragePath = '/media/lov3catch/A0FB-B842/statistic_storage' |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# Example of `bridge' design pattern | |
# This code is part of http://wp.me/p1Fz60-8y | |
# Copyright (C) 2011 Radek Pazdera | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or |
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; | |
__author__ = 'lov3catch' | |
from datetime import datetime | |
import time | |
import requests | |
currencies_optional = ['ADP', 'CZK', 'GBP'] | |
args = dict( |
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
<video width="400" controls preload="auto"> | |
<source src="{{ url_for('static', filename='qqq.ogv') }}" type="video/mp4"> | |
<source src="{{ url_for('static', filename='qqq.ogv') }}" type="video/ogv"> | |
</video> |
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
# start_date = DateTimeField(default=datetime.datetime.now) | |
# http://api.mongodb.org/python/current/api/bson/objectid.html | |
orders = Order.objects() | |
for order in orders: | |
print 'generation: ',order.id.generation_time | |
print 'create: ',order.date | |
# order.date = order.id.generation_time | |
# order.save() |
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 | |
import time | |
def run_checker(fn): | |
def wrapped(): | |
print 'check' | |
return fn() |
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 tzwhere import tzwhere | |
time_zone_getter = tzwhere.tzwhere() | |
def convert_time_for_me(self, datetime_obj): | |
''' | |
getting datetime obj and convert to datetime with same timezone | |
''' | |
def time_zone(me): | |
lng, lat = db.session.query(ST_X(me.location)).first()[0], db.session.query(ST_Y(me.location)).first()[0] | |
tz = time_zone_getter.tzNameAt(lat, lng) |
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 sqlalchemy | |
from sqlalchemy import schema | |
from sqlalchemy import types | |
from sqlalchemy.orm import relationship | |
from sqlalchemy.orm import sessionmaker | |
from sqlalchemy.ext.declarative import declarative_base | |
metadata = schema.MetaData() | |
BaseObject = declarative_base(metadata=metadata) |
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
data = [2, 3] | |
# actions | |
def aaa(data): | |
return [i+'_aaa' for i in data()] | |
def bbb(data): | |
return [i+'_bbb' for i in data()] | |
# templates |
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
class Statuses(object): | |
ON = 1 | |
OFF = 2 | |
class Singleton(type): | |
_instance = None | |
def __call__(cls, *args, **kwargs): |
OlderNewer