From anonymous, 2 Months ago, written in Ruby.
Embed
  1. #!/usr/bin/env ruby
  2. Signal.trap(:INT){ abort "\n(interrupted by SIGINT)" }
  3.  
  4. paste = ARGF.read
  5. puts "paste size: #{paste.size}"
  6. require_relative "../lib/paster"
  7. paster = Paster paste
  8.  
  9. require "tty-prompt"
  10. paster = begin
  11.   TTY::Prompt.new.select "expiration:", {
  12.     "doesn't matter": false,
  13.     "burn after reading": "burn",
  14.     "keep forever": 0,
  15.     "5 minutes": 5,
  16.     "1 hour": 60,
  17.     "1 day": 1440,
  18.     "1 week": 10080,
  19.     "1 month": 40320,
  20.     "1 year": 483840,
  21.   }.map{ |name, value|
  22.     paster = paster.dup
  23.     paster.expire = value
  24.     size = paster.services.size
  25.     size.zero? ?
  26.       {name: "#{name}", value: paster, disabled: "(no pastebins)"} :
  27.       {name: "#{name} (#{size})", value: paster}
  28.   }, filter: true, cycle: true, per_page: 100
  29. rescue TTY::Reader::InputInterrupt
  30.   abort ""
  31. end
  32.  
  33. paster.paste
  34.  
  35.  
  36. __END__
  37.  
  38. <select name="expire" id="expire" class="select" tabindex="7">
  39. <option value="burn">Burn on reading</option>
  40. <option value="5">5 Minutes</option>
  41. <option value="60">1 Hour</option>
  42. <option value="1440">1 Day</option>
  43. <option value="10080">1 Week</option>
  44. <option value="40320">1 Month</option>
  45. <option value="483840">1 Year</option>
  46. <option value="0" selected="selected">Keep Forever</option>
  47. </select>
  48.  
  49.                        year maxsize  raw syntax lineno expire expno burn unlisted private edit nojs api multiple auth openid delanon delfree delpub highlight
  50.                        -    +        +   +      +      +      +     +    +        +       +    +    +   +        +    +      +       +       -      +
  51. sprunge.us             2008 10000000 1   1      1      0      0     0    1        0       0    1    1   0        0    0      0       0       0      0
  52. paste.the-compiler.org 2013 15000000 1   1      1      1      1     1    1        0       0    1    1   0        0    0      0       0       0      0
  53.