Textmate 2

7 views
Skip to first unread message

arnaud sellenet

unread,
May 28, 2012, 3:35:58 AM5/28/12
to toulo...@googlegroups.com
Salut les toulouserbystes !

Vlà encore un petit contest de cochon,
Fanboy dans l'âme et en manque de mises à jour de textmate2, je me suis demandé quand même s'il y avait pas eu du neuf depuis le mois de décembre....

Donc il y a bien eu un update en février, la 9110. Et là apparemment une 9113.
Si vous avez des version-à-votre-sauce-pour-la-beauté-du-fun-de-la-gloire je suis preneur !

require "net/http"
require "uri"

(9111..10000).each do |n|
uri = URI.parse("http://dl.textmate.org/Application/TextMate_r#{n}.tbz")
response = Net::HTTP.get_response(uri)
puts "match #{n}" unless response.code.to_i == 403
puts "...#{n}"
sleep 2
end


Thomas

unread,
May 29, 2012, 3:03:43 AM5/29/12
to toulo...@googlegroups.com
2012/5/28 arnaud sellenet <arnod...@gmail.com>:
hoy

humm perso j'utilise plutôt open-uri maintenant, plus simple, plus concis,
et plutôt que de tester le 403 je testerai le 200 pour pouvoir
manipuler plus correctement les autres retours possibles (50X, etc)

my shot donc : https://gist.github.com/3a21dcff0cd0fa347347

avec la boucle principale inspirée de
http://somethingsimilar.com/2007/08/07/openuri-exceptions-and-http-status-codes/

en passant j'ai croisé une classe intéressante pour gérer les time
outs : http://www.ruby-doc.org/stdlib-1.9.2/libdoc/timeout/rdoc/Timeout.html
et oui c'est dans la stdlib

--
Thomas Riboulet
+33 (0) 698 926 057

Joël AZÉMAR

unread,
May 29, 2012, 4:24:21 AM5/29/12
to toulo...@googlegroups.com
#!/usr/bin/env ruby

require "net/http"
require "uri"

(9113..10000).each do |n|
  response = Net::HTTP.get_response(uri)
  unless response.code.to_i == 403
    exit
  end
  puts "...#{n}"
  sleep 2
end

Joël

2012/5/28 arnaud sellenet <arnod...@gmail.com>

Thomas

unread,
May 29, 2012, 5:05:58 AM5/29/12
to toulo...@googlegroups.com
Joel, tu fais 2 get sur l'url du coup la non ?

2012/5/29 Joël AZÉMAR <joel....@gmail.com>:

Joël AZÉMAR

unread,
May 29, 2012, 9:53:16 AM5/29/12
to toulo...@googlegroups.com
Ton code corrigé => https://gist.github.com/2828485

Marchait pas :(

Joël

2012/5/29 Thomas <ribo...@gmail.com>

Joël AZÉMAR

unread,
May 29, 2012, 9:53:55 AM5/29/12
to toulo...@googlegroups.com
Comment bypasser ça ?

Une solution ?

Joël

2012/5/29 Thomas <ribo...@gmail.com>

Olivier Azeau

unread,
May 29, 2012, 1:12:59 PM5/29/12
to toulo...@googlegroups.com
Avec copy stream ?

https://gist.github.com/2829565

Olivier


On 29/05/2012 15:53, Joël AZÉMAR wrote:
> Comment bypasser ça ?
>
> Une solution ?
>
> Joël
>
> 2012/5/29 Thomas <ribo...@gmail.com <mailto:ribo...@gmail.com>>
>
> Joel, tu fais 2 get sur l'url du coup la non ?
>
> 2012/5/29 Joël AZÉMAR <joel....@gmail.com
> <mailto:joel....@gmail.com>>:
> > #!/usr/bin/env ruby
> >
> > require "net/http"
> > require "uri"
> >
> > (9113..10000).each do |n|
> > uri =
> URI.parse("http://dl.textmate.org/Application/TextMate_r#{n}.tbz")
> > response = Net::HTTP.get_response(uri)
> > unless response.code.to_i == 403
> > puts "match #{n}
> http://dl.textmate.org/Application/TextMate_r#{n}.tbz"
> > system "wget
> http://dl.textmate.org/Application/TextMate_r#{n}.tbz"
> > exit
> > end
> > puts "...#{n}"
> > sleep 2
> > end
> >
> > Joël
> >
> >
> > 2012/5/28 arnaud sellenet <arnod...@gmail.com
> <mailto:arnod...@gmail.com>>
> >>
> >> Salut les toulouserbystes !
> >>
> >> Vlà encore un petit contest de cochon,
> >> Fanboy dans l'âme et en manque de mises à jour de textmate2, je
> me suis
> >> demandé quand même s'il y avait pas eu du neuf depuis le mois de
> >> décembre....
> >>
> >> Donc il y a bien eu un update en février, la 9110. Et là
> apparemment une
> >> 9113.
> >> Si vous avez des
> version-à-votre-sauce-pour-la-beauté-du-fun-de-la-gloire
> >> je suis preneur !
> >>
> >> require "net/http"
> >> require "uri"
> >>
> >> (9111..10000).each do |n|
> >> uri =
> URI.parse("http://dl.textmate.org/Application/TextMate_r#{n}.tbz")
> >> response = Net::HTTP.get_response(uri)
> >> puts "match #{n}" unless response.code.to_i == 403
> >> puts "...#{n}"
> >> sleep 2
> >> end
> >>
> >>
> >
>
>
>
> --
> Thomas Riboulet
> +33 (0) 698 926 057 <tel:%2B33%20%280%29%20698%20926%20057>
>
>

Joël AZÉMAR

unread,
May 29, 2012, 1:53:08 PM5/29/12
to toulo...@googlegroups.com
Très intéressant ! Merci.

Envoyé de mon iPhone

Le 29 mai 2012 à 19:13, Olivier Azeau <olivie...@gmail.com> a écrit :

> Avec copy stream ?
>
> https://gist.github.com/2829565
>
> Olivier
>
>
> On 29/05/2012 15:53, Joël AZÉMAR wrote:
>> Comment bypasser ça ?
>>
>> Une solution ?
>>
>> Joël
>>
>> 2012/5/29 Thomas <ribo...@gmail.com <mailto:ribo...@gmail.com>>
>>
>> Joel, tu fais 2 get sur l'url du coup la non ?
>>
>> 2012/5/29 Joël AZÉMAR <joel....@gmail.com
>> <mailto:joel....@gmail.com>>:
>> > #!/usr/bin/env ruby
>> >
>> > require "net/http"
>> > require "uri"
>> >
>> > (9113..10000).each do |n|
>> > uri > URI.parse("http://dl.textmate.org/Application/TextMate_r#{n}.tbz")
>> > response = Net::HTTP.get_response(uri)
>> > unless response.code.to_i == 403
>> > puts "match #{n}
>> http://dl.textmate.org/Application/TextMate_r#{n}.tbz"
>> > system "wget
>> http://dl.textmate.org/Application/TextMate_r#{n}.tbz"
>> > exit
>> > end
>> > puts "...#{n}"
>> > sleep 2
>> > end
>> >
>> > Joël
>> >
>> >
>> > 2012/5/28 arnaud sellenet <arnod...@gmail.com
>> <mailto:arnod...@gmail.com>>
>> >>
>> >> Salut les toulouserbystes !
>> >>
>> >> Vlà encore un petit contest de cochon,
>> >> Fanboy dans l'âme et en manque de mises à jour de textmate2, je
>> me suis
>> >> demandé quand même s'il y avait pas eu du neuf depuis le mois de
>> >> décembre....
>> >>
>> >> Donc il y a bien eu un update en février, la 9110. Et là
>> apparemment une
>> >> 9113.
>> >> Si vous avez des
>> version-à-votre-sauce-pour-la-beauté-du-fun-de-la-gloire
>> >> je suis preneur !
>> >>
>> >> require "net/http"
>> >> require "uri"
>> >>
>> >> (9111..10000).each do |n|
>> >> uri > URI.parse("http://dl.textmate.org/Application/TextMate_r#{n}.tbz")
>> >> response = Net::HTTP.get_response(uri)
>> >> puts "match #{n}" unless response.code.to_i == 403
>> >> puts "...#{n}"
>> >> sleep 2
>> >> end
>> >>
>> >>
>> >
>>
>>
>>
>> --
>> Thomas Riboulet
>> +33 (0) 698 926 057 <tel:%2B33%20%280%29%20698%20926%20057>
>>
>>
>
Reply all
Reply to author
Forward
0 new messages