Skip to content

Instantly share code, notes, and snippets.

@movitto
movitto / resiliance.rb
Last active August 29, 2015 14:06
Ruby ReFS parser
#!/usr/bin/ruby
# resilience.rb - Ruby ReFS Parser
# Copyright (C) 2014 Red Hat Inc.
require 'optparse'
require 'colored'
FIRST_PAGE_ID = 0x1e
PAGE_SIZE = 0x4000
@movitto
movitto / rels.rb
Created November 2, 2014 20:54
ReFS File Lister
#!/usr/bin/ruby
# ReFS File Lister
# Copyright (C) 2014 Red Hat Inc.
require 'optparse'
require 'colored'
FIRST_PAGE_ID = 0x1e
PAGE_SIZE = 0x4000
FIRST_PAGE_ADDRESS = FIRST_PAGE_ID * PAGE_SIZE
@movitto
movitto / fsoup.rb
Created November 7, 2014 20:58
FileSystem Soup
# FSoup - filesystem soup
# Disk and File System Factory
#
# Licensed under the MIT license
# Copyright (C) 2014 Red Hat Inc.
$include_factories = true
module FSoup
module Util
@movitto
movitto / barber.ino
Last active September 26, 2015 01:55
Bitcoin Aware Barber's Pole
//// Bitcoin Barber Shop Pole
//// Author: Mo Morsi <mo@morsi.org>
//// Arduino Controller Sketch
////
//// License: MIT
//// For use at the Syracuse Innovators Guild (sig315.org)
#include <SPI.h>
#include <Ethernet.h>
@movitto
movitto / gru.rb
Created November 8, 2012 03:07
gem rpm updater
#!/usr/bin/ruby
# gem rpm updater
#
# Will checkout an existing gem rpm from fedora,
# and update to the latest version found on http://rubygems.org
#
# Usage:
# gru.rb <gem_name>
#
# Licensed under the MIT License
@movitto
movitto / fgc.rb
Created June 5, 2013 18:03
Fedora Gemfile Checker - Compare a Bundler Gemfile to the Fedora Ruby Stack
#!/usr/bin/ruby
# Fedora Gemfile Checker
# Print out Gemfile dependencies, highlighting
# missing dependencies and those that are remotely
# available in Fedora.
#
# Licensed under the MIT license
# Copyright (C) 2013 Red Hat, Inc.
# Written By Mo Morsi <mmorsi@redhat.com>
###########################################################
@movitto
movitto / rhgc.rb
Last active December 20, 2015 06:29
Red Hat Gemfile Checker - Cross-reference a Bundler Gemfile to various package repositories and apis
#!/usr/bin/ruby
# Red Hat Gem Checker
# Print out Gem/Gemspec/Gemfile dependencies, highlighting
# missing dependencies and those that are remotely
# available in various locations including koji,
# git, fedora, bodhi, rhn, etc.
#
# Licensed under the MIT license
# Copyright (C) 2013 Red Hat, Inc.
# Written By Mo Morsi <mmorsi@redhat.com>
@movitto
movitto / yrc.rb
Created July 26, 2013 05:00
yrc.rb - yum ruby checker
#!/usr/bin/ruby
# yrc.rb - yum ruby checker
#
# Looks up missing binary dependencies required by ruby packages via yum.
#
# gem install packages as normal. If any fail due to missing requirements,
# run this script w/ the location of the failed install like so:
#
# ./yrc.rb <path-to-gem-install>
#
@movitto
movitto / rubygem-json-validate-const-strings.rb
Last active December 21, 2015 06:08
Workaround to security fix in rubygem-json commit #d0a62f3c fixing a situation which attacker could use the constant resolution mechanism in the json gem to subject the machine running it to a DoS attack. The fix involved disabling the conversion of json into ruby classes by default and recommending that the developer only enable it for validate…
require 'json'
module JSON
class << self
def deep_const_get(path)
path.to_s.split(/::/).inject(Object) do |p, c|
case
when c.empty? then p
when p.constants.collect { |c| c.to_s }.include?(c)
then p.const_get(c)
@movitto
movitto / rubygem-json-prevalidate-conversion-classes.rb
Last active December 21, 2015 06:08
Workaround to security fix in rubygem-json commit #d0a62f3c fixing a situation which attacker could use the constant resolution mechanism in the json gem to subject the machine running it to a DoS attack. The fix involved disabling the conversion of json into ruby classes by default and recommending that the developer only enable it for validate…
require 'json'
class Class
class << self
attr_accessor :permitted_json_classes
end
def permit_json_create
Class.permitted_json_classes ||= []
unless Class.permitted_json_classes.include?(self.name)