Skip to content

Instantly share code, notes, and snippets.

View jonmagic's full-sized avatar

Jonathan Hoyt jonmagic

View GitHub Profile
@jonmagic
jonmagic / hack-day-12-31-2013.md
Created January 1, 2014 01:45
Had some fun hacking on an Imp and Arduino Yun today.

Hack day (12-31-2013)

My goals for today are to get both devices (imp and yun) connected to the WIFI and then start testing sensors.

Connecting to the WIFI

Imp

I just followed these directions making sure to cover the top of the Imp with my finger so light didn't leak while doing the BlinkUp process. Super simple and just worked.

#!/Library/RubyMotion/bin/ruby -wKUW0
# if your using MacRuby you might change this to
# => #!/usr/bin/env macruby -wKUW0
framework 'Foundation'
framework 'ScriptingBridge'
# the original is part of an arstechnica article by Ryan
# SOURCE: http://arstechnica.com/apple/2011/09/tutorial-os-x-automation-with-macruby-and-the-scripting-bridge/
# this script with get your favourite songs and create a Evernote Note # German and English
window.onload=function(){
d3.select("#frame").on("mousemove", marker);
var canvas = d3.select("#canvas")
function marker()
{
var arrow = d3.mouse(this);
canvas.append("circle")
# Rails CVE-2013-0156 IRB Shell PoC
#
# Adapted from
# https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/multi/http/rails_xml_yaml_code_exec.rb
# http://ronin-ruby.github.com/blog/2013/01/09/rails-pocs.html
# http://blog.codeclimate.com/blog/2013/01/10/rails-remote-code-execution-vulnerability-explained/
#
require "net/https"
require 'uri'
@jonmagic
jonmagic / gist:3838029
Created October 5, 2012 04:09
Crazy helpful rake tasks for understanding what indexes to use in MongoDB (extracted from a Rails app at GitHub).
# If you are using in a Rails app just add gem 'plucky' to Gemfile.
# Otherwise install the plucky gem and require it.
# require 'plucky'
#
# Halp.mongo_db is just a shortcut to the database I already connected
# to using the mongo ruby driver.
#
# http://api.mongodb.org/ruby/current/file.TUTORIAL.html has instructions
# for the mongo ruby driver.
class Discussion
States = {
:new => 0,
:open => 1,
:closed => 2,
}
end
@jonmagic
jonmagic / gist:1810305
Created February 12, 2012 19:08
jQuery plugin template in CoffeeScript
$ = jQuery # Adds plugin object to jQuery
$.fn.extend {}= # Change the pluginName
queueSearch: (options) ->
settings = # Default settings
option1: true
option2: false
debug: false
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>jonmagic.com {{ blog.title }}</title>
<link href="{{ blog.feed.url }}" rel="self" />
<link href="{{ blog.url }}" />
<id>{{ blog.url }}</id>
<updated>{{ blog.last_updated_at | isodate }}</updated>
{% for post in blog.recent_posts.15 %}
<entry>