Skip to content

Instantly share code, notes, and snippets.

View gmas's full-sized avatar

George Masgras gmas

  • Barcelona
  • 15:06 (UTC +02:00)
View GitHub Profile
1981:cms $ rspec ./spec/models/sqs_queue_processor_spec.rb -fs --color
/Users/xxx.yyy/.rvm/gems/ruby-1.9.3-p286@mew_cms/gems/padrino-core-0.10.6/lib/padrino-core/reloader.rb:106:in `block in lock!': undefined method `split' for name(.):XPath::Expression::Name (NoMethodError)
from /Users/xxx.yyy/.rvm/gems/ruby-1.9.3-p286@mew_cms/gems/padrino-core-0.10.6/lib/padrino-core/reloader.rb:106:in `map'
from /Users/xxx.yyy/.rvm/gems/ruby-1.9.3-p286@mew_cms/gems/padrino-core-0.10.6/lib/padrino-core/reloader.rb:106:in `lock!'
from /Users/xxx.yyy/.rvm/gems/ruby-1.9.3-p286@mew_cms/gems/padrino-core-0.10.6/lib/padrino-core/loader.rb:68:in `load!'
from /Users/xxx.yyy/Documents/work/cms/config/boot.rb:66:in `<top (required)>'
from /Users/xxx.yyy/Documents/work/cms/spec/spec_helper.rb:2:in `require'
from /Users/xxx.yyy/Documents/work/cms/spec/spec_helper.rb:2:in `<top (required)>'
from /Users/xxx.yyy/Documents/work/cms/spec/models/sqs_queue_processor_spec.rb:1:in `requir
@gmas
gmas / configboot.rb
Created November 8, 2012 22:41
spec_helper.rb
# Defines our constantsPADRINO_ENV = ENV['PADRINO_ENV'] ||= ENV['RACK_ENV'] ||= 'development' unless defined?(PADRINO_ENV)
PADRINO_ROOT = File.expand_path('../..', __FILE__) unless defined?(PADRINO_ROOT)
# Load our dependencies
require 'rubygems' unless defined?(Gem)
require 'bundler/setup'
Bundler.require(:default, PADRINO_ENV)
require_relative '../lib/database'
##
@gmas
gmas / Ruby.markdown
Created February 17, 2014 05:28 — forked from avdi/Ruby.markdown

Core ideas

  • An Object is a set of instance variables and a pointer to a 'singleton class'.
  • Properties are looked up in the instance variables, methods are dispatched via the singleton class.
  • Module is a subtype of Object. A Module is a set of methods and an ordered list of zero-or-more 'parent' modules.
  • Module A becomes a parent of module B via B.include(A).
  • Method lookup works by doing a depth-first right-to-left search of a module tree.
  • Class is a subtype of Module. A Class is a Module that can be instantiated.
  • A Class has only one 'superclass'. A class includes its superclass as its first parent module for the purposes of method dispatch. A class's singleton class includes the superclass's singleton class as its first parent.
  • The default superclass of all classes is Object.
%s/:\(\w\+\)\(\s*=>\s*\)/\1: /gc
@gmas
gmas / 98-usb.rules
Last active August 29, 2015 14:00
add named symlink to USB device
#/etc/udev/rules.d/98-usb.rules
KERNEL=="sd*", SUBSYSTEM=="block", ENV{ID_SERIAL_SHORT}=="FDC0FD20EF00000FD0FFC4F0715317", SYMLINK+="usb"
@gmas
gmas / gist:11334960
Created April 27, 2014 00:49
redirect traffic for user/port
#privoxy running HTTP proxy on port 8118
iptables -t nat -A OUTPUT -p tcp --dport 80 -m owner --uid-owner debian-transmission -j REDIRECT --to-port 8118
ssh-copy-id pi@192.168.X.X
# on the pi
sudo su -
cat <<EOF >> /etc/wpa_supplicant/wpa_supplicant.conf
network={
ssid="Your SSID Here"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
@gmas
gmas / gist:dafc55f0ab766a05626e
Last active August 29, 2015 14:02
batch scan Sane
scanimage --resolution 300 --mode Gray --button-controlled=yes \
--format=tiff --batch-count 3 --batch="/nas/incoming/image-%d.tiff"
keys *name*
type name (should be SET)
smembers name
@gmas
gmas / gist:dbf2409ea3efe4cd7762
Created September 21, 2014 04:32
upload hex program to Arduberry w/avrdude
avrdude -c gpio -p m328p -U flash:w:file_name.hex