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 -*- | |
import sys | |
from forq import db, create_app | |
def drop(): | |
db.drop_all() | |
print 'Dropping completed successful!' |
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 | |
''' | |
USAGE: | |
./rate.py <amount:float> <bid|ask> | |
''' | |
import sys | |
import requests |
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 re | |
import copy | |
import BeautifulSoup | |
class HTMLSanitizer(object): | |
# replace hexadecimal character reference by decimal one | |
_hexentity_massage = (copy.copy(BeautifulSoup.MARKUP_MASSAGE) + | |
[(re.compile('&#x([^;]+);'), |
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 voluptuous import Schema | |
data = { | |
'InactiveMails': 26, | |
'Bounces': [ | |
{ | |
'Name': 'All', | |
'Count': 30 | |
}, | |
{ |
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 r2.models import Subreddit | |
from r2.lib.db.queries import get_links | |
def fix_sr(name): | |
sr = Subreddit._by_name(name) | |
for sort in ('hot', 'new', 'controversial', 'top'): | |
get_links(sr, sort, 'all').update() |
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
def secure_url_for(endpoint, *args, **kwargs): | |
# Force generate https url. Necessarily is _external | |
kwargs['_external'] = True | |
url = url_for(endpoint, *args, **kwargs) | |
parsed = urlparse(url) | |
parsed._replace(scheme='https') | |
return urlunparse(parsed) |
NewerOlder