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 https://cipherli.st/ | |
# and https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html | |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | |
ssl_prefer_server_ciphers on; | |
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH"; | |
ssl_ecdh_curve secp384r1; | |
ssl_session_cache shared:SSL:10m; | |
ssl_session_tickets off; | |
ssl_stapling on; |
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
import webpack from 'webpack'; | |
import config from '../../config'; | |
import HtmlWebpackPlugin from 'html-webpack-plugin'; | |
import ExtractTextPlugin from 'extract-text-webpack-plugin'; | |
const paths = config.get('utils_paths'), | |
globals = config.get('globals'); | |
const webpackConfig = { | |
name : 'server', |
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 collections import Counter | |
import re | |
from functools import reduce | |
def reduce_line(line): | |
words = re.findall('\w+',line.lower()) | |
return Counter(words) | |
maps = map(reduce_line, open('time_machine.txt').readlines()) | |
z = reduce(lambda x,y: x+y, maps) |
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.conf import settings | |
import requests | |
import simplejson as json | |
def krakenize(url, height=None, width=None): | |
''' | |
Krakenizes an image url and returns a file object. | |
@return-example: | |
b'{"file_name":"P1jX7RP.jpg","original_size":68979, | |
"kraked_size":65234,"saved_bytes":3745, |
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
INSERT INTO users | |
SELECT username,password,first_name,last_name,email,is_staff,is_active,facebook_id,twitter_username,mobile_number,dob,receive_sms,receive_email, gender, | |
'ecr',last_login,date_joined,address,city,zipcode,province,about_me | |
FROM dblink('host=127.0.0.1 port=5432 dbname=ecr_live user=postgres password=postgres','SELECT * from auth_user') AS au(id integer, | |
username character varying(30) , | |
first_name character varying(30) , | |
last_name character varying(30) , | |
email character varying(75) , | |
password character varying(128) , | |
is_staff boolean , |
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
import itertools | |
import re | |
a = ['1','2','3','4','5','6','7','8','9'] | |
b = ['+','-',''] | |
p = [list(itertools.product(t,b)) for t in a] | |
p[-1].remove(('9','-')) #Can't have any + or - after | |
p[-1].remove(('9','+')) | |
#[[('1', '+'), ('1', '-'), ('1', '')], | |
# [('2', '+'), ('2', '-'), ('2', '')], |
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 logging.handlers import SysLogHandler | |
from django.conf import settings | |
import json | |
import socket | |
from base64 import standard_b64encode | |
from Crypto.Cipher import AES | |
from Crypto import Random |
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 rest_framework.response import Response | |
import logging | |
import json | |
import re | |
import dill | |
from django.conf import settings | |
from django.core import cache as django_cache | |
from mock import patch | |
from rest_framework.permissions import SAFE_METHODS |
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
user=User(profile_image_url_https='https://pbs.twimg.com/profile_images/504390155868721152/iIf84NQV_normal.jpeg', protected=False, _api=<tweepy.api.API object at 0x10780e048>, profile_background_image_url='http://abs.twimg.com/images/themes/theme1/bg.png', favourites_count=27, profile_link_color='0084B4', verified=False, entities={'description': {'urls': []}}, created_at=datetime.datetime(2013, 9, 20, 21, 43, 16), location='sydney , australia', default_profile=True, utc_offset=None, listed_count=0, profile_background_tile=False, follow_request_sent=False, followers_count=19, id=1887955549, statuses_count=13, profile_location=None, url=None, geo_enabled=False, profile_sidebar_border_color='C0DEED', profile_image_url='http://pbs.twimg.com/profile_images/504390155868721152/iIf84NQV_normal.jpeg', profile_use_background_image=True, notifications=False, contributors_enabled=False, is_translator=False, id_str='1887955549', profile_background_color='C0DEED', _json={'profile_image_url_https': 'https://pbs.twimg.com/pr |
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
import facebook | |
from readability_score.calculators.fleschkincaid import * | |
from readability_score.calculators.dalechall import * | |
import numpy as np | |
import requests | |
from nltk.collocations import * | |
import nltk | |
bigram_measures = nltk.collocations.BigramAssocMeasures() | |
trigram_measures = nltk.collocations.TrigramAssocMeasures() |