Skip to content

Instantly share code, notes, and snippets.

View wflanagan's full-sized avatar

William Flanagan wflanagan

View GitHub Profile
@wflanagan
wflanagan / setup.sh
Created January 30, 2024 21:30 — forked from chris-sev/setup.sh
Mac Setup
# how to run this thingy
# create a file on your mac called setup.sh
# run it from terminal with: sh setup.sh
# heavily inspired by https://twitter.com/damcclean
# https://github.com/damcclean/dotfiles/blob/master/install.sh
# faster dock hiding/showing (run in terminal)
# defaults write com.apple.dock autohide-delay -float 0; defaults write com.apple.dock autohide-time-modifier -int 0;killall Dock
## This should return hits, it doesn't.
curl -XGET "http://localhost:9200/mentions_production/_search" -H 'Content-Type: application/json' -d'{ "query": { "term": {"references": "publisher/profile:mumo.beaplumbereducationok.rocks"} }}'
## If you do the query adding the aggs, it then errors wtih a fielddata error
curl -XGET "http://localhost:9200/mentions_production/_search" -H 'Content-Type: application/json' -d'{ "query": { "term": {"references": "publisher/profile:mumo.beaplumbereducationok.rocks"} }, "aggs": { "friendly_ids": { "terms": { "field": "references" } } }}'
## This one retrieves correctly
curl -XGET "http://localhost:9200/mentions_production/_search" -H 'Content-Type: application/json' -d'{ "query": { "bool": { "must": { "match": {"references": "publisher/profile:mumo.beaplumbereducationok.rocks"} } } }}'
## This one errors when you add the aggs to it
Parent 1
"twitter/profile:andyoakes",
"periscope/profile:691880" # when this redirects it redirects to andyoakes as the name, so it would cluster
Parent 2
"email/profile:newdigitalage&host=bluestripemedia.co.uk",
"twitter/profile:bluestripemedia
Parent 3
"linkedin/company:newdigitalage",
{"severity":"INFO","progname":"audienti","request_id":"ActiveJob","time":"2019-11-27T21:32:51.756+01:00","message":"status=success action=profile_deleted profile='Profile:#linkedin/company:channel-newsasia'","class_name":"Pipeline::Profile::LowPriorityEnrichJob","job_id":"13262789-fd15-487f-b8e2-9e2f7135508d","profile":"Profile:#linkedin/company:channel-newsasia"}
{"severity":"INFO","progname":"audienti","request_id":"ActiveJob","time":"2019-11-27T21:32:51.756+01:00","message":"profile_was_deleted","class_name":"Pipeline::Profile::LowPriorityEnrichJob","job_id":"13262789-fd15-487f-b8e2-9e2f7135508d","profile_id":"linkedin/company:channel-newsasia"}
{"severity":"INFO","progname":"audienti","request_id":"ActiveJob","time":"2019-11-27T21:32:51.757+01:00","message":null,"class_name":"Pipeline::Profile::LowPriorityEnrichJob","job_id":"13262789-fd15-487f-b8e2-9e2f7135508d","state":"perform_complete","took":"9407.19"}
2019-11-27T20:32:51.758Z 14916 TID-ot0bvd8w4 Pipeline::Profile::LowPriorityEnrichJob JID-dce2c5d81a
module YourService
class Config
class << self
def config
@config ||= new.config
end
end
def config
@config ||= YAML.load(File.read(config_file))
@wflanagan
wflanagan / custom_aliases.sh
Last active November 14, 2017 13:38
custom_aliases.sh file for use in our dev environment
# Add to your path to the application for editing
# This file is automatically generated.
# v0.1.1 14November2017 837amEST
# This file was generated at <%= Time.now.utc %>
<% if defined?(home) && home.to_s.length > 0 %>
export DEVELOPER_HOME="<%= home %>"
<% end -%>
<% if defined?(app_path) && app_path.to_s.length > 0 %>
export APP_PATH="<%= app_path %>"
@wflanagan
wflanagan / 0_reuse_code.js
Created September 21, 2017 13:03
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@wflanagan
wflanagan / app_init.coffee
Last active June 12, 2017 23:58
What i'm trying to do.
window.App ||= {}
# This is what calls the KeywordsIndex class and initializes it.
class PageInit
constructor: ->
page = "#{$('body').data('page')}"
@execute_page_js(page)
execute_page_js: (page) ->
if "function" is typeof window[page]
klass = window[page]
test_string = "key=1 key2=keys2 message=this is a message that is a long message key3=key key4=four"
# candidate regex (\w+)=(\w+) but it misses beyond the this in the message attribute
# what I want
# [['key', '1'], ['key2', 'keys2'], ['message', 'this is a message that is a long message'],['key3', 'key'],['key4', 'four']]
books = ["Charlie and the Chocolate Factory", "War and Peace", "Utopia", "A Brief History of Time", "A Wrinkle in Time"]
books.sort! # sorts the books in place
books = books.sort # sorts them, putting them back into the books variable.
books = books.sort_by { |book| book.length } # sorts them into the length of their title, shortest first