Skip to content

Instantly share code, notes, and snippets.

Michael Mahemoff mahemoff

Block or report user

Report or block mahemoff

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mahemoff
mahemoff / gist:8885615
Last active Aug 29, 2015
Dbpedia Ruby
View gist:8885615
# Using https://github.com/farbenmeer/dbpedia
# http://stackoverflow.com/questions/13033841/dbpedia-country-profile-query
# See also http://stackoverflow.com/questions/15610033/query-cities-and-their-country-from-dbpedia
# List of countries, including defunct countries
Dbpedia.sparql.query('select ?country where { ?country rdf:type dbpedia-owl:Country }')
# List of modern countries
select ?country where { ?country <http://purl.org/dc/terms/subject> <http://dbpedia.org/resource/Category:Member_states_of_the_United_Nations>; <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Country> } order by ?country
View gist:8918750
"Project Default Service Account" is what Google Plus calls default OAuth providers. As the developer, change it in the console under "Consent screen".
@mahemoff
mahemoff / gist:8973559
Created Feb 13, 2014
Reference data in Linode API
View gist:8973559
# Setup
require 'pp'
require 'linode'
l = Linode.new api_key: 'my-api-key' # Get that from https://manager.linode.com/profile/index
a = l.avail
# Let's Rock It ...
2.1.0 :011 > pp a.datacenters
@mahemoff
mahemoff / linode
Created Feb 13, 2014
Ansible Linode module - changes to remove Linode ID name prefix, and to add private IP support.
View linode
# api.linode_update(LinodeId=linode_id, Label='%s_%s' % (linode_id, name))
api.linode_update(LinodeId=linode_id, Label='%s' % (name))
api.linode_ip_addprivate(LinodeId=linode_id)
@mahemoff
mahemoff / ask-wikipedia.rb
Last active Aug 29, 2015 — forked from emad-elsaid/ask-wikipedia.rb
Refactor processing, make script standalone with initial env, add command-line argument
View ask-wikipedia.rb
#!/usr/bin/env ruby
require 'open-uri'
require 'json'
language = 'en'
article = ARGV[0] ||
begin
print 'What do you need to know? : '
URI::encode gets.chomp
@mahemoff
mahemoff / gist:9214688
Created Feb 25, 2014
callbacks stacktrace
View gist:9214688
/Users/ruby/.rvm/gems/ruby-2.1.0/bundler/gems/rails-25a05723792b/activesupport/lib/active_support/core_ext/module/aliasing.rb:32:in `alias_method': undefined method `_compile_filter' for class `ActiveSupport::Callbacks::Callback' (NameError)
from /home/project/.rvm/gems/ruby-2.1.0/bundler/gems/rails-25a05723792b/activesupport/lib/active_support/core_ext/module/aliasing.rb:32:in `alias_method_chain'
from /home/project/demo/config/initializers/log_callbacks.rb:3:in `included'
from /home/project/demo/config/initializers/log_callbacks.rb:37:in `include'
from /home/project/demo/config/initializers/log_callbacks.rb:37:in `<top (required)>'
from /home/project/.rvm/gems/ruby-2.1.0/bundler/gems/rails-25a05723792b/activesupport/lib/active_support/dependencies.rb:241:in `load'
from /home/project/.rvm/gems/ruby-2.1.0/bundler/gems/rails-25a05723792b/activesupport/lib/active_support/dependencies.rb:241:in `block in load'
from /home/project/.rvm/gems/ruby-2.1.0/bundler/gems/rails-25a05723792b/activesupport/lib/active
@mahemoff
mahemoff / unicorn
Last active Aug 29, 2015 — forked from ethier/gist:7190310
Update the upgrade function - it captures the old PID before it's overwritten by the upgrade (ie USR2 signal), then kills it once the upgrade has succeeded
View unicorn
#!/bin/sh
# forked from https://gist.github.com/ethier/7190310
# via http://uncorruptedstate.com/blog/2013/10/27/zero-downtime-deployment-with-rails-and-unicorn/
### Unicorn variables ###
TIMEOUT=${TIMEOUT-60}
APP_ROOT=/home/web/current
UNICORN=$APP_ROOT/bin/unicorn
TMP_PATH=$APP_ROOT/tmp
PID_PATH=$APP_ROOT/tmp/pids
@mahemoff
mahemoff / gist:9684727
Created Mar 21, 2014
Common Ansible ssh error
View gist:9684727
FAILED => SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue
In my experience, this is almost because I forgot add the user. Add "-u username" to the ansible command-line call.
@mahemoff
mahemoff / Github mail
Created Mar 26, 2014
Odd situation involving private legacy fork of public repo
View Github mail
Upcoming changes to your fork mahemoff/yeoman
GitHub support@github.com
12:50 AM (7 hours ago)
Dear mahemoff,
During recent maintenance we discovered that your private fork mahemoff/yeoman's parent repository yeoman/yeoman is public. We no longer allow the creation of private forks from public repositories, so we need to make some changes to your fork.
To protect your code's privacy we don't automatically make a fork public to match the parent repository. Instead, mahemoff/yeoman will be unforked in three days and become a new private repository under your account.
View index.html
<a href="https://player.fm/featured/accounting">Accounting</a>
<br>
<a href="https://player.fm/featured/acoustic">Acoustic</a>
<br>
<a href="https://player.fm/featured/adventist">Adventist</a>
<br>
<a href="https://player.fm/featured/after-life">After Life</a>
<br>
<a href="https://player.fm/featured/agile">Agile</a>
<br>
You can’t perform that action at this time.