<commit_before>#!/usr/bin/env ruby
#
# <NAME>, 2009-02-15
#
require 'ffi-ncurses'
include FFI::NCurses
begin
  initscr
  raw
  keypad stdscr, true
  noecho
  curs_set 0
  ch = 0
  name = "none"
  # while ch != 27                # Escape
  while ch != KEY_CTRL_Q
    clear
    addstr "Press any key (Escape to exit): "
    #printw "name: %s dec: %d char: [%c]", :string, name, :int, ch, :int, ch
    addstr sprintf("name: %s dec: %d char: [%s]", name, ch, ch > 0 ? ch.chr : " ")
    refresh
    ch = getch
    name = keyname(ch)
  end
ensure
  endwin
end
<commit_msg>fixed keys example to allow function keys<commit_after>#!/usr/bin/env ruby
#
# <NAME>, 2009-02-15
#
require 'ffi-ncurses'
include FFI::NCurses
begin
  initscr
  raw
  keypad stdscr, true
  noecho
  curs_set 0
  ch = 0
  name = "none"
  # while ch != 27                # Escape
  while ch != KEY_CTRL_Q
    clear
    addstr "Press any key (Escape to exit): "
    #printw "name: %s dec: %d char: [%c]", :string, name, :int, ch, :int, ch
    addstr sprintf("name: %s dec: %d char: [%s]", name, ch, (1..127).include?(ch) ? ch.chr : " ")
    refresh
    ch = getch
    name = keyname(ch)
  end
ensure
  endwin
end

{'fraction_non_alphanumeric': 0.14553191489361703, 'fraction_numerical': 0.02468085106382979, 'mean_word_length': 2.607361963190184, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '6295608', 'n_tokens_mistral': 494, 'n_tokens_neox': 467, 'n_words': 145}