<commit_before>require 'sinatra'
require 'json'

set :root, File.join(File.dirname(__FILE__), '..')
set :views, Proc.new { File.join(root, "views") } 

get '/' do
	haml :home
end

def get_elevation(lon,lat)
  lat_floor = lat.floor
  lon_floor = lon.floor
  lon_floor_s = lon_floor.to_s
  if(lon_floor<100) 
    lon_floor_s = "0"+lon_floor_s
    if(lon_floor<10)
      lon_floor_s = "0"+lon_floor_s
    end
  end
  p "elevation/N#{lat_floor}E#{lon_floor_s}.hgt"
  if File.exist?("elevation/N#{lat_floor}E#{lon_floor_s}.hgt")
    latpos = 1201-(1200*(lat-lat_floor)).round
    lngpos = (1200*(lon-lon_floor)).round
    seek = 2*1201*latpos+2*lngpos
    i = IO.binread("elevation/N#{lat_floor}E#{lon_floor_s}.hgt",2,seek)
    if i
      arr = i.unpack("CC")
      e = arr[0]*256+arr[1]<commit_msg>filename again<commit_after>require 'sinatra'
require 'json'

set :root, File.join(File.dirname(__FILE__), '..')
set :views, Proc.new { File.join(root, "views") } 

get '/' do
	haml :home
end

def get_elevation(lon,lat)
  lat_floor = lat.floor
  lon_floor = lon.floor
  lon_floor_s = lon_floor.to_s
  if(lon_floor<100) 
    lon_floor_s = "0"+lon_floor_s
    if(lon_floor<10)
      lon_floor_s = "0"+lon_floor_s
    end
  end
  filename =  "elevation/N#{lat_floor}E#{lon_floor_s}.hgt"
  if File.exist?(filename)
    latpos = 1201-(1200*(lat-lat_floor)).round
    lngpos = (1200*(lon-lon_floor)).round
    seek = 2*1201*latpos+2*lngpos
    i = IO.binread(filename,2,seek)
    if i
      arr = i.unpack("CC")
      e = arr[0]*256+arr[1]
{'fraction_non_alphanumeric': 0.16175507531106745, 'fraction_numerical': 0.04060248853962017, 'mean_word_length': 3.8050314465408803, 'pattern_counts': {'":': 0, '<': 7, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6087309', 'n_tokens_mistral': 688, 'n_tokens_neox': 650, 'n_words': 102}