Skip to content

Instantly share code, notes, and snippets.

View eddanger's full-sized avatar
🏕️
Probably camping

Michael Wood eddanger

🏕️
Probably camping
View GitHub Profile

Keybase proof

I hereby claim:

  • I am eddanger on github.
  • I am mdub (https://keybase.io/mdub) on keybase.
  • I have a public key ASCSwkQCzR1D_LShYysF4QGSRqMD8jqjLpGoib1MxW1yfQo

To claim this, I am signing this object:

@eddanger
eddanger / cryptobot.js
Created October 12, 2017 22:03
My little script to check my returns on my bittrex account
"use strict";
const ccxt = require ('ccxt')
const asTable = require ('as-table')
const log = require ('ololog').configure ({ locate: false })
require ('ansicolor').nice;
// The amount of BTC I moved into my Bittrex account
const investedBTC = 0.18469975;
@eddanger
eddanger / mongo_patch.rb
Created June 4, 2015 20:47
Mongo BSON Injection: Ruby Regexps Strike Again
# http://sakurity.com/blog/2015/06/04/mongo_ruby_regexp.html
# There’s a subtle bug in BSON-ruby implementation, leading in best case
# scenario to low-severity DoS, but most likely to critical BSON Injection
# (similar to SQL injection) - depends on gem versions you use.
# b = Moped::BSON::ObjectId
# puts "Injection!" if b.legal? "a"*24+"\na"
# puts "DOS" if b.legal? "a"*24+"\n"
@eddanger
eddanger / _forward80.md
Last active May 25, 2016 18:09
Port Forwarding from 80 to 8080 in Yosemite

Add com.coverall file to /etc/pf.anchors with:

rdr pass on lo0 inet proto tcp from any to 127.0.0.1 port = 80 -> 127.0.0.1 port 8080
rdr pass on en0 inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080
rdr pass on en1 inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080
rdr pass on en2 inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080

Update pf.conf to point to this new file a-la:

@eddanger
eddanger / new_rails_api_project_part1.md
Last active March 7, 2018 10:08
New Rails 4.2 API project with Rivets.js, Coffeescript, Sass and Bootstrap

Keybase proof

I hereby claim:

  • I am eddanger on github.
  • I am mdub (https://keybase.io/mdub) on keybase.
  • I have a public key whose fingerprint is 9B97 8FB4 E1AE 5F68 597B 5CA4 C4E7 481F 2711 9334

To claim this, I am signing this object:

@eddanger
eddanger / exception_notification.rb
Created August 14, 2014 16:29
Slack and Campfire Rails Exception notification
# Docs: http://smartinez87.github.io/exception_notification/
module ExceptionNotifier
class SlackNotifier
def initialize(options)
# do something with the options...
@channel = options[:channel] || '#somechannel'
@team = options[:team] || 'someteam'
@token = options[:token] || '__top_secret_token__'
@username = options[:username] || 'somename'
@eddanger
eddanger / time_range.rb
Created March 2, 2014 02:44
Optimize time range comparisons using step
start1 = Time.parse('01:00')
end1 = Time.parse('10:00')
timespan1 = (start1.to_i..(end1.to_i - 1))
timespan1b = (start1.to_i..(end1.to_i - 1)).step(1.minute)
start2 = Time.parse('10:00')
end2 = Time.parse('18:30')
timespan2 = (start2.to_i..(end2.to_i - 1))
timespan2b = (start2.to_i..(end2.to_i - 1)).step(1.minute)
@eddanger
eddanger / usage.rb
Created February 28, 2014 23:30
Convert locales files for testing new locales.
locale = YAML.load_file("#{Rails.root}/config/locales/en.yml")
new_locale = zero_value_in_hash(locale)
puts new_locale.to_yaml
@eddanger
eddanger / basecamp2github.rb
Created December 8, 2011 05:23 — forked from chip/basecamp2github.rb
Convert Basecamp tasks to Github issues
require 'rubygems'
require 'active_resource'
require 'basecamp'
require 'httparty'
require 'json'
GITHUB_USERNAME = '__GITHUB_USERNAME__'
GITHUB_PASSWORD = '__GITHUB_PASSWORD__'
GITHUB_ORG = '__GITHUB_ORG__'
GITHUB_REPO = '__GITHUB_REPO__'