...upgrade RVM it has a hardcoded notion which patch level it considers to be "1.9.3". This can give you errors like "ruby-1.9.3-p392 is not installed" even if you...

...have another Ruby 1.9.3 that will do. The solution is to define an alias: rvm alias create 1.9.3 ruby-1.9.3-p385 Fuzzy matching Another solution is to use rvm with...

makandra dev
serverfault.com

...a fixed number. #!/usr/bin/env bash interface=eth0 dumpdir=/tmp/ packet_threshold=5000 log_packets=100000 while /bin/true; do pkt_old=`grep $interface: /proc/net/dev | cut -d : -f2 | awk '{ print $2 }'`

pkt_new=`grep $interface: /proc/net/dev | cut -d : -f2 | awk '{ print $2 }'` pkt=$(( $pkt_new - $pkt_old )) echo -ne "\r$pkt packets/s\033[0K" if [ $pkt -gt $packet_threshold ]; then...

While RSpec 1 and 2 decided that specs inside spec/model are model specs, and those inside spec/features are feature specs (and so on), RSpec 3 will no longer do that...

...due to a conflict, for example), you may want to know the current commit. [1]\ Luckily, there is lots of useful stuff in the .git directory. Commit hash that you...

...Handy when you want to look at that branch's state of the file. [1] While git shows the commit when stopping at conflicts, for example, that information may have...

Follow the instructions here. PRs at makandra/rubocop-config are welcome. Also check the issue tracker. RubyMine Since version 2017-1 RubyMine...

github.com

...main() in -lc... yes creating Makefile ... cc1: all warnings being treated as errors Makefile:150: recipe for target 'gherkin_lexer_ar.o' failed make: *** [gherkin_lexer_ar.o] Error 1 ...

In Ruby 1.9, instance_eval calls the block the with receiver as the first argument: In Ruby 1.8, receiver.instance_eval(&block) calls block.call() In Ruby 1.9, receiver.instance_eval(&block) calls...

...block.call(receiver) This will blow up in your face in Ruby 1.9, where a lambda crashes when it is called with a different number of arguments: wrong number of arguments...

...cast strings into their respective types like this: Note.columns_hash['user_id'].type_cast('123') # => 123 Note.columns_hash['deleted'].type_cast('1') # => true Note.columns_hash['deleted'].type_cast('0') # => false

...Button Sound”; the “Power Save Audio” entry is usually grayed out, so this is 1 beep less than from above.) Right Down Tick Do it this way or your colleagues...

...will stand at your desk after the 12th beep, ready to smack you...

askubuntu.com

...s the default for switching input languages (i.e. keyboard layouts). If you use only 1 language/layout, you will not notice except for the key not working.

...ibus-setup (e.g. from a terminal). This will open a GUI dialog. In the 1st tab you should see "Next Input Method" followed by " space". Click the "..." button on the...

If you get a message like this: Jan 21 13:42:38 foobar syslogd: /var/log/authlog : no such file or directory But you are sure the file exists and it have...

...the correct permissions: # example for Solaris 9 -rw-r--r-- 1 root sys 8,0K 21. Jan 13:51 /var/log/authlog Then you perhaps have a trailing whitespace after /var/log/authlog in...

explainshell.com

...with each option explained. About Hello, This site contains 29761 parsed manpages from sections 1 and 8 found in Ubuntu's manpage repository. A lot of heuristics were used to...

...will open an debugging IRB right away, like this: require File.dirname(__FILE__) + '/../config/boot' (rdb:1) _ Enter c to continue and reach your actual debugger call. Then, debug away.

...can feed it to block-taking methods by prefixing it with &: printer = method(:puts) [1, 2, 3].each(&printer) # will print one line per number

stats = {} ObjectSpace.each_object {|o| stats[o.class].nil? ? stats[o.class] = 0 : stats[o.class] += 1 }; stats => {String=>192038, Array=>67690, Time=>2667, Gem::Specification=>2665, Regexp=>491, Gem::Requirement=>16323...

makandra dev

Make sure the daemon is running. Error: Process /usr/lib/sflphone/sflphoned exited with status 1 This mean the last process didn't shut down properly and let a PID file...

...If you've shut sflphone down some seconds ago, you just have to wait 10 seconds and don't have to remove the pid file manually...

imperialviolet.org

...and no special hardware. On our production frontend machines, SSL/TLS accounts for less than 1% of the CPU load, less than 10KB of memory per connection and less than...

...With a block, it counts the number of elements yielding a truthy value. ary = [1, 2, 4, 2] ary.count #=> 4 ary.count(2) #=> 2 ary.count { |x| x...

...weekdays (Monday to Friday) between to given dates, try this: require 'date' a = Date.parse "11.04.2014" b = Date.parse "31.12.2014" (a..b).count {|date| (1..5).include?(date.wday...

The following snippet will convert a string with wildcards to a appropriate regexp, i.e. parse_wildcards("foobar") # => /\Afoo.bar\z/

execute "SET @pos := 0;" update " UPDATE pages SET position = ( SELECT @pos := @pos + 1 ) ORDER BY updated_at DESC...

When your block takes an argument that should have an default, only in Ruby 1.9 you can say: block = lambda do |message, options = {}| # ... end If you are on Ruby 1.8.6...

...or 1.8.7 you must resort to the following workaround: block = lambda do |*args| message = args[0] options = args[1] || {}

makandra dev

...to a variable and further want to use it. Example: irb(main):001:0> 1 + 2 => 3 irb(main):002:0> _ => 3 irb(main):003:0> a...

jimneath.org

...and many more you'll need when reading weird code. Regex $~ (last MatchData) $1 $2 $3 $4 (match groups from the last pattern match) $& (last matched string) $+ (last match...