<commit_before>require 'sinatra'
require 'sinatra/flash'
require 'haml'
require 'redis'

enable :sessions

get '/' do
  haml :index
end

post '/post' do
  charset = %w{ 2 3 4 6 7 9 a c d e f g h j k m n p q r t v w x y z}
  token = (0...3).map{ charset.to_a[rand(charset.size)] }.join
  REDIS.set(token, params[:text])
  REDIS.expire(token, 60) # 3600 secs = 1 hour
  flash[:success] = "Ok. Scan the QR code or copy the link below to share this item."
  redirect "/#{token}"
end

get '/:token' do
  token = params[:token]
  @text = REDIS.get(token)
  @expire = REDIS.ttl(token)
  if @text.nil?<commit_msg>Change expiration to 10 minutes<commit_after>require 'sinatra'
require 'sinatra/flash'
require 'haml'
require 'redis'

enable :sessions

get '/' do
  haml :index
end

post '/post' do
  charset = %w{ 2 3 4 6 7 9 a c d e f g h j k m n p q r t v w x y z}
  token = (0...3).map{ charset.to_a[rand(charset.size)] }.join
  REDIS.set(token, params[:text])
  REDIS.expire(token, 600)
  flash[:success] = "Ok. Scan the QR code or copy the link below to share this item."
  redirect "/#{token}"
end

get '/:token' do
  token = params[:token]
  @text = REDIS.get(token)
  @expire = REDIS.ttl(token)
  if @text.nil?
{'fraction_non_alphanumeric': 0.14403973509933773, 'fraction_numerical': 0.023178807947019868, 'mean_word_length': 3.3333333333333335, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6727172', 'n_tokens_mistral': 511, 'n_tokens_neox': 470, 'n_words': 173}