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
{ | |
"query":{ | |
"constant_score":{ | |
"filter":{ | |
"and":[ | |
{"term":{ | |
"nginx_host.raw":"media.scpr.org" | |
}}, | |
{"terms":{ | |
"qvia":["podcast"] |
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
filter { | |
if [type] == "nginx" { | |
grok { | |
match => ["message", "%{NGINXACCESS}" ] | |
} | |
grok { | |
match => ["request","%{URIPATH:request_path}(?:%{URIPARAM:request_params})?"] | |
} | |
date { | |
match => [ "timestamp", "dd/MMM/yyyy:HH:mm:ss Z", "dd/MMM/yyyy:HH:mm:ss" ] |
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
# disable JSON inflation | |
JSON.create_id = "no_thanks" | |
out_dir = "BACKUP" | |
Dir.mkdir(out_dir) | |
["nodes","clients","roles"].each do |t| | |
Dir.mkdir( File.join( out_dir, t) ) | |
names = api.get(t).keys | |
names.each do |name| |
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
# Be sure to restart your server when you modify this file. | |
class JSONVerifier < ActiveSupport::MessageVerifier | |
def verify(signed_message) | |
raise InvalidSignature if signed_message.blank? | |
data, digest = signed_message.split("--") | |
if data.present? && digest.present? && secure_compare(digest, generate_digest(data)) | |
ActiveSupport::JSON.decode(Base64.decode64(data.gsub('%3D','='))) |
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
# -- find content by bylines -- # | |
# HACK -- This is hardcoded to news stories, blog entries and show segments for now | |
finder = ContentByline.objects.raw(""" | |
select | |
contentbase_contentbyline.id, | |
contentbase_contentbyline.object_id, | |
contentbase_contentbyline.content_type_id, | |
COALESCE(news_story.published_at,shows_segment.created_at,blogs_entry.published_at) as pub_date | |
from |
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.core.cache import cache | |
DEFAULT_TIMEOUT = 0 | |
SET_PREFIX = "obj:" | |
FSET_PREFIX = "sobj:" | |
def set(key,val,timeout = DEFAULT_TIMEOUT,objects = []): | |
""" | |
Unlike the normal django / redis cache, ContentCache takes a collection | |
of objects that this cache depends on. This allows the cache to be |