Skip to content

Instantly share code, notes, and snippets.

View davedash's full-sized avatar
🏠
Working from home

Dave Dash davedash

🏠
Working from home
View GitHub Profile
@davedash
davedash / long_task.rb
Last active August 28, 2015 17:54
No timing
# Import a blog post.
def ingest(external_post)
map = AuthorExternalMap.find_by_external_id(external_post.author_id)
if map.present?
author = Author.where(id: map.author_id).include(posts: [:categories]).try(:first)
category = Category.find_or_create_by!(name: external_post.category_name)
post = find_existing_post(external_post)
# Import a blog post.
def ingest(external_post)
map = nil
MyStatsd.client.time('find_map') do
map = AuthorExternalMap.find_by_external_id(external_post.author_id)
end
if map.present?
author = nil
MyStatsd.client.time('find_author') do
{
"default" : "https://phabricator.whatever.com/"
}
Error attempting to use stored discovery information: <openid.consumer.consumer.TypeURIMismatch: Required type http://specs.openid.net/auth/2.0/signon not found in ['http://specs.openid.net/auth/2.0/server', 'http://openid.net/srv/ax/1.0', 'http://specs.openid.net/extensions/ui/1.0/mode/popup', 'http://specs.openid.net/extensions/ui/1.0/icon', 'http://specs.openid.net/extensions/pape/1.0'] for endpoint <openid.consumer.discover.OpenIDServiceEndpoint server_url='https://www.google.com/accounts/o8/ud' claimed_id=None local_id=None canonicalID=None used_yadis=True >>
require "./test2.rb"
def hi_replacement
puts "new thing"
end
hi = hi_replacement
hi
#!/bin/bash
CHUNK=5
MYSQL_CMD="SHOW SLAVE STATUS\G"
MYSQL="/usr/bin/mysql"
GREP="grep Sec"
START=$(echo $MYSQL_CMD|$MYSQL|$GREP|cut -d: -f2)
i=0
function slaving_stopped {
policy = """{
"Statement":[{
"Effect":"Allow",
"Action":["s3:*"],
"Resource":["arn:aws:s3:::mybucket"]}]}"""
import boto
c = boto.connect_iam()
instance_profile = c.create_instance_profile('myinstanceprofile')
role = c.create_role('myrole')
c.add_role_to_instance_profile('myinstanceprofile', 'myrole')
{
"index": {
"analysis": {
"filter": {
"autocomplete_filter": {
"type": "edge_ngram",
"min_gram": "1",
"max_gram": "20"
},
"word_joiner": {
"word_joiner": {
"type": "word_delimiter",
"catenate_all": true
}
#!/bin/sh
set -e
# An example hook script to verify what is about to be pushed. Called by "git
# push" after it has checked the remote status, but before anything has been
# pushed. If this script exits with a non-zero status nothing will be pushed.
#
# This hook is called with the following parameters:
#