[#386100] Numeric#coerce docs are disaster — 7stud -- <bbxx789_05ss@...>

num.coerce(numeric) =E2=86=92 array

14 messages 2011/08/02

[#386114] Documentation Improvement Proposal — Chris White <cwprogram@...>

=3D Issues =3D

24 messages 2011/08/02
[#386115] Re: Documentation Improvement Proposal — Steve Klabnik <steve@...> 2011/08/02

I reeeeeealy dislike user comments on documentation. It's one of the

[#386117] Re: Documentation Improvement Proposal — Phillip Gawlowski <cmdjackryan@...> 2011/08/02

On Tue, Aug 2, 2011 at 7:39 PM, Steve Klabnik <steve@steveklabnik.com> wrot=

[#386118] Re: Documentation Improvement Proposal — Steve Klabnik <steve@...> 2011/08/02

> What's wrong with stealing WikiPedia's procedures? The model works

[#386119] Re: Documentation Improvement Proposal — Chris White <cwprogram@...> 2011/08/02

On Aug 2, 2011, at 11:00 AM, Steve Klabnik wrote:

[#386123] Re: Documentation Improvement Proposal — Steve Klabnik <steve@...> 2011/08/02

Apologies, I've just responded to everyone in-line.

[#386231] Brainstorming ideas how to improve Ruby's documentation — Marc Heiler <shevegen@...>

The title is misleading...

42 messages 2011/08/05
[#386233] Re: Brainstorming ideas how to improve Ruby's documentation — "Fred L." <f.linard@...> 2011/08/05

Hello,

[#386235] Re: Brainstorming ideas how to improve Ruby's documentation — Alexander Litvinovsky <alexander.litvinovsky@...> 2011/08/05

What are you talking about? Ruby has a nice docs, railsapi.com for example.

[#386297] Help out with the next version of ruby-lang.org — Magnus Holm <judofyr@...>

https://github.com/rubylang/ruby-lang.org

11 messages 2011/08/07

[#386341] Exceptional Ruby and Metaprogramming Ruby has anyone picked these up? — Kevin <darkintent@...>

I'm thinking of picking up these two books and was wondering if anyone

11 messages 2011/08/09

[#386378] ruby installation — "Momodou J." <modou75alieu@...>

how to implement this in windows :

16 messages 2011/08/09

[#386401] *WHY* does this not work? — serialhex <serialhex@...>

ok, so code:

23 messages 2011/08/09
[#386403] Re: *WHY* does this not work? — "Darryl L. Pierce" <mcpierce@...> 2011/08/09

On Wed, Aug 10, 2011 at 03:52:59AM +0900, serialhex wrote:

[#386404] Re: *WHY* does this not work? — serialhex <serialhex@...> 2011/08/09

On Tue, Aug 9, 2011 at 3:05 PM, Darryl L. Pierce <mcpierce@gmail.com> wrote:

[#386480] Odd regexp behavior — Glen Holcomb <damnbigman@...>

I'm running 1.9.2-p180

16 messages 2011/08/10

[#386506] Distributing Ruby program as a standalone executable (exe) for windows — Michelle Pace <michelle@...>

Hello there,

10 messages 2011/08/11

[#386539] Online tutor for Ruby — T J Pereira <tj5155@...>

I am finding it difficult to apply the RUBY program. Its because i have

18 messages 2011/08/12
[#386541] Re: Online tutor for Ruby — Phillip Gawlowski <cmdjackryan@...> 2011/08/12

On Fri, Aug 12, 2011 at 6:00 AM, T J Pereira <tj5155@tm.net.my> wrote:

[#386637] class inheritance and class constants — Iñaki Baz Castillo <ibc@...>

------------------------

16 messages 2011/08/14

[#386784] Green Shoes v1.0 released — ashbb <ashbbb@...>

Hello, everyone.

15 messages 2011/08/18
[#392062] Re: Green Shoes v1.0 released — Barry Yu <yubarry@...> 2012/01/09

why do I get this error?

[#386796] Searching in a directory — Yu Yu <htwoo@...>

Hello,

21 messages 2011/08/18

[#386893] Gritty Details of super() — luke gruber <luke.gru@...>

Hey guys,

18 messages 2011/08/21

[#386900] Possble bug in Ruby parser (Fixnum#times within "case" statement) — Iñaki Baz Castillo <ibc@...>

Hi, I cannot find an explanation for the following issue so I think it's a =

15 messages 2011/08/21
[#386901] Re: Possble bug in Ruby parser (Fixnum#times within "case" statement) — Ryan Davis <ryand-ruby@...> 2011/08/21

[#386903] Re: Possble bug in Ruby parser (Fixnum#times within "case" statement) — Iñaki Baz Castillo <ibc@...> 2011/08/21

2011/8/22 Ryan Davis <ryand-ruby@zenspider.com>:

[#386920] New to Ruby some problems — jack jones <shehio_22@...>

I am new to Ruby, My mother tongue is C++ .. I have too many problems I

21 messages 2011/08/22

[#386949] Want to get involved with this doc stuff? I'm making it even easier — Steve Klabnik <steve@...>

Hey guys-

9 messages 2011/08/22

[#387058] How the access the values of this result — QAS WM <qaiserwali@...>

I am getting the following as a result of a script I run.

11 messages 2011/08/26

[#387070] overloading methods question please? — jack jones <shehio_22@...>

def do_something(a as Array)

11 messages 2011/08/26

[#387138] String#split resets regex captures variables (Ruby 1.8.7) — Olivier Lance <bestiol@...>

Hi,

10 messages 2011/08/29

[#387196] SAMSUNG to produce "Ruby on Rails in Silicon" System on a Chip — Ilias Lazaridis <ilias@...>

(public draft)

9 messages 2011/08/31

[#387197] Prepend a character to a string in ruby — ruby rails <rubyonrails4me@...>

Hi,

10 messages 2011/08/31

[#387212] GUI programming — Samuel Mensah <sasogeek@...>

Is ruby GUI programming something that will come along as I study ruby

19 messages 2011/08/31
[#387230] Re: GUI programming — Alexey Petrushin <axyd80@...> 2011/08/31

I believe right now it's better to stay with console, there's no Ruby

Re: Unwanted scan() method behavior

From: Panagiotis Atmatzidis <ml@...>
Date: 2011-08-14 18:46:29 UTC
List: ruby-talk #386649
Hello,

Thanks for reply,

On 14 =CE=91=CF=85=CE=B3 2011, at 9:06 =CE=BC.=CE=BC., Bartosz =
Dziewo=C5=84ski wrote:

> I re-read your mail and realized that I don't really understand what
> you're trying to accomplish, and my previous mail wasn't probably
> really useful. Sorry.

I don't blame you for that, neither would I probably.

>=20
> -- Matma Rex
>=20



Here's a better explanation:

-------------------------------------

$ sed 's/[0-9]\{1,3\}\(\.[0-9]\{1,3\}\)\{3\}/(127.0.0.1)/' <fail2ban.log =
> fail2ban.log
$ cat fail2ban.log

2011-08-07 23:32:09,210 fail2ban.server : INFO   Changed logging target =
to /var/log/fail2ban.log for Fail2ban v0.8.4
2011-08-07 23:32:09,237 fail2ban.jail   : INFO   Creating new jail =
'ssh-ipfw'
2011-08-07 23:32:09,239 fail2ban.jail   : INFO   Jail 'ssh-ipfw' uses =
poller
2011-08-07 23:32:09,373 fail2ban.filter : INFO   Added logfile =3D =
/var/log/secure.log
2011-08-07 23:32:09,376 fail2ban.filter : INFO   Set maxRetry =3D 3
2011-08-07 23:32:09,379 fail2ban.filter : INFO   Set findtime =3D 600
2011-08-07 23:32:09,381 fail2ban.actions: INFO   Set banTime =3D 600
2011-08-07 23:32:09,659 fail2ban.jail   : INFO   Jail 'ssh-ipfw' started
2011-08-08 07:37:00,199 fail2ban.actions: WARNING [ssh-ipfw] Ban =
127.0.0.1
2011-08-08 07:37:04,328 fail2ban.actions: WARNING [ssh-ipfw] Ban =
127.0.0.1
2011-08-08 07:47:00,650 fail2ban.actions: WARNING [ssh-ipfw] Unban =
127.0.0.1
2011-08-08 07:47:05,248 fail2ban.actions: WARNING [ssh-ipfw] Unban =
127.0.0.1
2011-08-09 00:25:38,918 fail2ban.actions: WARNING [ssh-ipfw] Ban =
127.0.0.1
2011-08-09 00:35:39,631 fail2ban.actions: WARNING [ssh-ipfw] Unban =
127.0.0.1
2011-08-09 03:58:18,229 fail2ban.actions: WARNING [ssh-ipfw] Ban =
127.0.0.1
2011-08-09 04:08:18,904 fail2ban.actions: WARNING [ssh-ipfw] Unban =
127.0.0.1
2011-08-09 06:04:18,785 fail2ban.actions: WARNING [ssh-ipfw] Ban =
127.0.0.1
2011-08-09 06:14:19,403 fail2ban.actions: WARNING [ssh-ipfw] Unban =
127.0.0.1
2011-08-09 09:43:32,351 fail2ban.actions: WARNING [ssh-ipfw] Ban =
127.0.0.1
2011-08-09 09:53:32,964 fail2ban.actions: WARNING [ssh-ipfw] Unban =
127.0.0.1
2011-08-09 23:07:48,462 fail2ban.actions: WARNING [ssh-ipfw] Ban =
127.0.0.1
2011-08-09 23:17:49,334 fail2ban.actions: WARNING [ssh-ipfw] Unban =
127.0.0.1
2011-08-09 23:37:50,235 fail2ban.actions: WARNING [ssh-ipfw] Ban =
127.0.0.1
2011-08-09 23:47:50,446 fail2ban.actions: WARNING [ssh-ipfw] Unban =
127.0.0.1
2011-08-10 02:09:32,868 fail2ban.actions: WARNING [ssh-ipfw] Ban =
127.0.0.1
2011-08-10 02:19:33,067 fail2ban.actions: WARNING [ssh-ipfw] Unban =
127.0.0.1
2011-08-10 13:41:46,288 fail2ban.actions: WARNING [ssh-ipfw] Ban =
127.0.0.1
2011-08-10 13:51:47,117 fail2ban.actions: WARNING [ssh-ipfw] Unban =
127.0.0.1
2011-08-10 22:50:44,647 fail2ban.actions: WARNING [ssh-ipfw] Ban =
127.0.0.1
2011-08-10 23:00:45,106 fail2ban.actions: WARNING [ssh-ipfw] Unban =
127.0.0.1
2011-08-10 23:18:48,976 fail2ban.actions: WARNING [ssh-ipfw] Ban =
127.0.0.1
2011-08-10 23:28:49,140 fail2ban.actions: WARNING [ssh-ipfw] Unban =
127.0.0.1
2011-08-11 07:32:36,636 fail2ban.server : INFO   Changed logging target =
to /var/log/fail2ban.log for Fail2ban v0.8.4
2011-08-11 07:32:36,664 fail2ban.jail   : INFO   Creating new jail =
'ssh-ipfw'
2011-08-11 07:32:36,666 fail2ban.jail   : INFO   Jail 'ssh-ipfw' uses =
poller
2011-08-11 07:32:36,800 fail2ban.filter : INFO   Added logfile =3D =
/var/log/secure.log
2011-08-11 07:32:36,802 fail2ban.filter : INFO   Set maxRetry =3D 3
2011-08-11 07:32:36,806 fail2ban.filter : INFO   Set findtime =3D 600
2011-08-11 07:32:36,808 fail2ban.actions: INFO   Set banTime =3D 600
2011-08-11 07:32:36,974 fail2ban.jail   : INFO   Jail 'ssh-ipfw' started =
                                                                         =
                                                                         =
                                                    =20
=20

$ cat myzonereport.rb

#!/usr/bin/env ruby

# encoding: UTF-8

# ZoneReport version v.02-alpha
# atma@convalesco.org

#require 'socket'

class Myzonereport
  attr_reader :logfile
 =20
  def initialize(logfile)
    raise "No fail2ban log file found!" if (logfile.empty?)
    @logfile =3D logfile
    @list =3D Hash.new
  end
 =20
  def readlog
    puts "I can't read the log file" unless (File.readable?(@logfile) || =
File.empty?(@logfile))
    log =3D File.read(@logfile)
    =
log.scan(/^(\d{4}-\d\d-\d\d).*?(\d{2}:\d{2}:\d{2},\d{3}).*?(Ban).*?(\d{1,3=
}\.\d{1,3}\.\d{1,3}\.\d{1,3})/).each do |date, time, string, ip|
        puts "id: #{time} | date: #{date} | IP: #{ip}"
    end
  end
 =20
  def rename
    time =3D Time.new
    date =3D time.strftime("%Y-%m-%d")
    if (File.exists?(@logfile) && File.readable?(@logfile))
      File.rename(@logfile, @logfile + "-" + date + '.log')
      File.new(@logfile)
    else
      puts "File '#{@logfile}' does not exist or it's not readable!"
    end
  end
 =20
 =20
 =20
end

x =3D Myzonereport.new('fail2ban.log')
puts x.readlog=1B[1m=1B[3m%=1B[23m=1B[1m=1B[0m                           =
                                                                         =
                                                                         =
                               =20
=20

$ ruby myzonereport.rb=08

atma@angel:/Volumes/atmosx/Programming/test/ > ruby myzonereport.rb=20
id: 07:37:00,199 | date: 2011-08-08 | IP: 127.0.0.1
id: 07:37:04,328 | date: 2011-08-08 | IP: 127.0.0.1
id: 00:25:38,918 | date: 2011-08-09 | IP: 127.0.0.1
id: 03:58:18,229 | date: 2011-08-09 | IP: 127.0.0.1
id: 06:04:18,785 | date: 2011-08-09 | IP: 127.0.0.1
id: 09:43:32,351 | date: 2011-08-09 | IP: 127.0.0.1
id: 23:07:48,462 | date: 2011-08-09 | IP: 127.0.0.1
id: 23:37:50,235 | date: 2011-08-09 | IP: 127.0.0.1
id: 02:09:32,868 | date: 2011-08-10 | IP: 127.0.0.1
id: 13:41:46,288 | date: 2011-08-10 | IP: 127.0.0.1
id: 22:50:44,647 | date: 2011-08-10 | IP: 127.0.0.1
id: 23:18:48,976 | date: 2011-08-10 | IP: 127.0.0.1
2011-08-08
07:37:00,199
Ban
127.0.0.1
2011-08-08
07:37:04,328
Ban
127.0.0.1
2011-08-09
00:25:38,918
Ban
127.0.0.1
2011-08-09
03:58:18,229
Ban
127.0.0.1
2011-08-09
06:04:18,785
Ban
127.0.0.1
2011-08-09
09:43:32,351
Ban
127.0.0.1
2011-08-09
23:07:48,462
Ban
127.0.0.1
2011-08-09
23:37:50,235
Ban
127.0.0.1
2011-08-10
02:09:32,868
Ban
127.0.0.1
2011-08-10
13:41:46,288
Ban
127.0.0.1
2011-08-10
22:50:44,647
Ban
127.0.0.1
2011-08-10
23:18:48,976
Ban
127.0.0.1

-------------------------------------

I would like to output to be just:

id: 07:37:00,199 | date: 2011-08-08 | IP: 127.0.0.1
id: 07:37:04,328 | date: 2011-08-08 | IP: 127.0.0.1
id: 00:25:38,918 | date: 2011-08-09 | IP: 127.0.0.1
id: 03:58:18,229 | date: 2011-08-09 | IP: 127.0.0.1
id: 06:04:18,785 | date: 2011-08-09 | IP: 127.0.0.1
id: 09:43:32,351 | date: 2011-08-09 | IP: 127.0.0.1
id: 23:07:48,462 | date: 2011-08-09 | IP: 127.0.0.1
id: 23:37:50,235 | date: 2011-08-09 | IP: 127.0.0.1
id: 02:09:32,868 | date: 2011-08-10 | IP: 127.0.0.1
id: 13:41:46,288 | date: 2011-08-10 | IP: 127.0.0.1
id: 22:50:44,647 | date: 2011-08-10 | IP: 127.0.0.1
id: 23:18:48,976 | date: 2011-08-10 | IP: 127.0.0.1


Hope this example makes the issue more clear.

Best Regards!


--
Panagiotis Atmatzidis

personal: atma@convalesco.org
lists: ml@convalesco.org
blog: http://www.convalesco.org

The wise man said: "Never argue with an idiot. They bring you down to =
their level and beat you with experience."







In This Thread