Skip to content

Instantly share code, notes, and snippets.

View malditogeek's full-sized avatar

Mauro Pompilio malditogeek

  • Freelance
  • Brighton, UK
View GitHub Profile
'use strict'
const WKX = require('wkx')
const Sequelize = require('sequelize')
// Workaround for the missing JSON-C (ST_GeomFromGeoJSON) dep in CloudSQL
// Issue: https://issuetracker.google.com/issues/37302950
class CloudSQLGeo extends Sequelize.DataTypes.GEOGRAPHY {
constructor() {
super()
node-gitter PRIVMSG #malditogeek/test ```
node-gitter PRIVMSG #malditogeek/test multi
node-gitter PRIVMSG #malditogeek/test line
node-gitter PRIVMSG #malditogeek/test msg
node-gitter PRIVMSG #malditogeek/test ```
IRC = require 'irc'
Gitter = require 'node-gitter'
TOKEN = process.env.TOKEN
ROOM = process.env.ROOM
CHANNEL = process.env.CHANNEL
gitter = new Gitter(TOKEN)
irc = new IRC.Client

Keybase proof

I hereby claim:

  • I am malditogeek on github.
  • I am malditogeek (https://keybase.io/malditogeek) on keybase.
  • I have a public key whose fingerprint is 655D 7F22 BF9A B53B 0A76 A203 BEC1 5B42 8C52 9E28

To claim this, I am signing this object:

~ $> nslookup vmux.co
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Name: vmux.co
Address: 165.225.131.4
Name: vmux.co
Address: 165.225.129.253
Name: vmux.co
@malditogeek
malditogeek / gist:3634879
Created September 5, 2012 10:45
astor proxy
class LibratoProxy
def on_readable(socket, messages)
messages.each {|msg| post_to_librato *msg.copy_out_string.split(' ') }
end
def post_to_librato(channel, metric_in_json)
metric = JSON.parse(metric_in_json)
# call to Librato API
end
@malditogeek
malditogeek / gist:3181653
Created July 26, 2012 11:55
monkeypatch
# Send notifications to Airbrake asynchronously using em-http.
# Doesn't handle Airbrake conn options but works for the default settings.
module Airbrake
class Sender
def send_to_airbrake(data)
client = EM::HttpRequest.new(url)
client.post(:head => HEADERS, :body => data)
rescue => ex
p [:AIRBRAKE_ERROR, ex.message, data]
end
@malditogeek
malditogeek / gist:3156358
Created July 21, 2012 16:36
Goliath + HAProxy deploy recipe
after "deploy:update", "deploy:cleanup"
after "deploy:update", "foreman:export"
after "deploy:symlink", "update_haproxy_config_symlink"
namespace :deploy do
task :stop do
run "sudo stop goliath_app"
end
task :start do
run "sudo start goliath_app"
require 'nokogiri'
require 'open-uri'
require 'pp'
# User provided Book Depository wishlist.
wishlist_url = 'http://www.bookdepository.com/wishlist/507838/Mauro-Pompilio'
# Fectch the wishlisted books.
def fetch_books(wishlist_url, page=1)
doc = Nokogiri::HTML(open("#{wishlist_url}/?page=#{page}"))
We couldn’t find that file to show.