# Encoding: UTF-8

[{beforeRunningCommand: "nop",
  command: 
   "get_pw () {\n  ruby -rui -e\"print TextMate::UI.request_secure_string(:title => 'Decrypt AES 128 Encrypted Text', :prompt => '$1', :button1 => '$2', :button2 => 'Cancel').to_s\"\n}\n\npw=$(get_pw 'What is the password?' Decrypt)\n[[ -z \"$pw\" ]] && exit_discard\n\nif ! openssl enc -d -aes128 -base64 -pass \"pass:$pw\"; then\n   exit_show_tool_tip\nfi\n",
  fallbackInput: "document",
  input: "selection",
  keyEquivalent: "^@E",
  name: "AES Decrypt Document / Selection With Password…",
  output: "replaceSelectedText",
  uuid: "4B22577B-BC8E-11D9-8946-000D93589AF6"},
 {beforeRunningCommand: "nop",
  command: 
   "get_pw () {\n  ruby -rui -e\"print TextMate::UI.request_secure_string(:title => 'Encrypt Text With AES 128', :prompt => '$1', :button1 => '$2', :button2 => 'Cancel').to_s\"\n}\npw1=$(get_pw 'What password should be used?'   Continue)\n[[ -z \"$pw1\" ]] && exit_discard\npw2=$(get_pw 'Enter password again to verify.' Encrypt)\n\nif [[ \"$pw1\" == \"$pw2\" ]];\n  then openssl enc -e -aes128 -base64 -pass \"pass:$pw1\"\n  else exit_show_tool_tip 'Password mismatch! Please play again.'\nfi\n",
  fallbackInput: "document",
  input: "selection",
  keyEquivalent: "^@E",
  name: "AES Encrypt Document / Selection With Password…",
  output: "replaceSelectedText",
  uuid: "D39DC176-BC8D-11D9-8946-000D93589AF6"},
 {beforeRunningCommand: "nop",
  command: "cat -n|expand -8",
  fallbackInput: "document",
  input: "selection",
  keyEquivalent: "",
  name: "Add Line Numbers to Document / Selection",
  output: "replaceSelectedText",
  uuid: "8085013F-8DEA-11D9-B421-000D93589AF6"},
 {beforeRunningCommand: "nop",
  command: 
   "#!/usr/bin/env ruby -wKU\nprint STDIN.read.unpack(\"U*\").map { |e| sprintf('0x%02x', e) }.join(' ')",
  fallbackInput: "character",
  input: "selection",
  keyEquivalent: "^X",
  name: "Convert Character / Selection to Hex",
  output: "replaceSelectedText",
  uuid: "7C9736B2-B851-11D9-B05D-00039369B986"},
 {beforeRunningCommand: "nop",
  bundleUUID: "B7BC3FFD-6E4B-11D9-91AF-000D93589AF6",
  command: 
   "res=$(ruby -rui -e\"print TextMate::UI.request_string(:title => 'Filter Matching Lines', :prompt => 'Enter a pattern:', :button1 => 'Filter', :button2 => 'Cancel').to_s\")\n\n[[ -z \"$res\" ]] && exit_discard\nexport pattern=\"$res\"\n\n# This could be done with grep, but Python's RE is closer to oniguruma\n\"${TM_PYTHON:-python}\" -c '\nimport sys, os, re, traceback\ntry:\n  pattern = re.compile(os.environ[\"pattern\"])\nexcept re.error, e:\n  sys.stderr.write(\"Invalid pattern: %s\" % e)\n  sys.exit(1)\nfor line in sys.stdin:\n  if pattern.search(line):\n    sys.stdout.write(line)\n' || exit_show_tool_tip\n",
  input: "selection",
  name: "Copy Matching Lines into New Document",
  output: "openAsNewDocument",
  uuid: "965DF29E-4EBD-457A-9A61-56D920C35F72"},
 {beforeRunningCommand: "nop",
  bundleUUID: "B7BC3FFD-6E4B-11D9-91AF-000D93589AF6",
  command: 
   "res=$(ruby -rui -e\"print TextMate::UI.request_string(:title => 'Filter Non-Matching Lines', :prompt => 'Enter a pattern:', :button1 => 'Filter', :button2 => 'Cancel').to_s\")\n\n[[ -z \"$res\" ]] && exit_discard\nexport pattern=\"$res\"\n\n# This could be done with grep, but Python's RE is closer to oniguruma\n\"${TM_PYTHON:-python}\" -c '\nimport sys, os, re, traceback\ntry:\n  pattern = re.compile(os.environ[\"pattern\"])\nexcept re.error, e:\n  sys.stderr.write(\"Invalid pattern: %s\" % e)\n  sys.exit(1)\nfor line in sys.stdin:\n  if not pattern.search(line):\n    sys.stdout.write(line)\n' || exit_show_tool_tip\n",
  input: "selection",
  name: "Copy Non-Matching Lines into New Document",
  output: "openAsNewDocument",
  uuid: "8109F2C2-FF63-46F7-83F3-D2318290FC11"},
 {beforeRunningCommand: "nop",
  bundleUUID: "B7BC3FFD-6E4B-11D9-91AF-000D93589AF6",
  command: 
   "res=$(ruby -rui -e\"print TextMate::UI.request_string(:title => 'Distill Text', :prompt => 'Enter a pattern:', :button1 => 'Filter', :button2 => 'Cancel').to_s\")\n\n[[ -z \"$res\" ]] && exit_discard\nexport pattern=\"$res\"\n\n# This could be done with grep, but Python's RE is closer to oniguruma\n\"${TM_PYTHON:-python}\" -c '\nimport sys, os, re, traceback\ntry:\n  pattern = re.compile(os.environ[\"pattern\"])\nexcept re.error, e:\n  sys.stderr.write(\"Invalid pattern: %s\" % e)\n  sys.exit(1)\nmate = \"\\\"%s/bin/mate\\\" -a\" % os.environ[\"TM_SUPPORT_PATH\"]\npb = os.popen(mate, \"w\")\nfor line in sys.stdin:\n  if pattern.search(line):\n    pb.write(line)\n  else:\n    sys.stdout.write(line)\npb.close()\n' || exit_show_tool_tip\n\n",
  input: "selection",
  name: "Distill Document / Selection",
  output: "replaceSelectedText",
  uuid: "DA5AD0D9-F7C0-4010-9FDC-FF01B0434F9A"},
 {beforeRunningCommand: "nop",
  command: 
   "#!/usr/bin/env ruby -wKU\n\n# If there’s a selection, output that twice (as a snippet)\n# leaving the duplicate as the new selected text.\n# Otherwise split the current line around the caret and\n# output “right, left” to duplicate the line, leaving the\n# caret in the same place on the new line\n\nrequire File.join(ENV[\"TM_SUPPORT_PATH\"], \"lib/exit_codes.rb\")\nrequire File.join(ENV[\"TM_SUPPORT_PATH\"], \"lib/escape.rb\")\n\nif ENV['TM_SELECTED_TEXT'] != nil\n\tTextMate.exit_insert_snippet(e_sn(ENV['TM_SELECTED_TEXT']) + \"${0:\" + e_snp(ENV['TM_SELECTED_TEXT']) + \"}\")\nelse\n\tcol   = ENV['TM_LINE_INDEX'].to_i\n\tTextMate.exit_insert_text(ENV['TM_CURRENT_LINE'][col..-1] + \"\\n\" + ENV['TM_CURRENT_LINE'][0...col])\nend",
  fallbackInput: "none",
  input: "selection",
  keyEquivalent: "^D",
  name: "Duplicate Line / Selection",
  output: "afterSelectedText",
  uuid: "C46A9DBC-0B06-49DF-838B-491B529ECF22"},
 {beforeRunningCommand: "nop",
  command: "open \"$(cat)\"\n",
  fallbackInput: "scope",
  input: "selection",
  keyEquivalent: "",
  name: "Open Current URL",
  output: "discard",
  scope: "markup.underline.link - markup.underline.link.relative",
  uuid: "5A08E461-05CC-4C03-9DC8-BF118594EA3E"},
 {beforeRunningCommand: "nop",
  command: 
   "ruby -pe'$_ = (rand * 100000000).round.to_s + \"\\t\" + $_'|sort|cut -f2-",
  input: "selection",
  name: "Randomize Lines in Document / Selection",
  output: "replaceSelectedText",
  uuid: "90291A6E-34F6-4FD5-BA82-6BB6FB4DD492"},
 {beforeRunningCommand: "nop",
  command: "perl -pe 's/[\\t ]+$//g'",
  fallbackInput: "document",
  input: "selection",
  name: "Remove Trailing Spaces in Document / Selection",
  output: "replaceSelectedText",
  uuid: "0F8C1F78-6E4C-11D9-91AF-000D93589AF6"},
 {beforeRunningCommand: "nop",
  command: "perl -pe 's/[^\\t\\n\\x20-\\xFF]|\\x7F|\\xC2[\\x80-\\x9F]//g'",
  fallbackInput: "document",
  input: "selection",
  name: "Remove Unprintable Characters in Document / Selection",
  output: "replaceSelectedText",
  uuid: "BEC25DC3-6E4B-11D9-91AF-000D93589AF6"},
 {beforeRunningCommand: "nop",
  command: "sort -f|uniq",
  input: "selection",
  keyEquivalent: "",
  name: "Sort Lines & Remove Duplicates",
  output: "replaceSelectedText",
  uuid: "3010E2A8-6E4F-11D9-A18D-000D93589AF6"},
 {beforeRunningCommand: "nop",
  command: "sort -f",
  fallbackInput: "document",
  input: "selection",
  keyEquivalent: "",
  name: "Sort Lines in Document / Selection",
  output: "replaceSelectedText",
  uuid: "273853DF-6E4F-11D9-A18D-000D93589AF6"},
 {beforeRunningCommand: "nop",
  command: "say `echo \"$TM_SELECTED_TEXT\"` &",
  input: "selection",
  name: "Speak Document / Selection",
  output: "discard",
  uuid: "D26BEEE3-7439-4B7E-AD9D-9A144CDC5873"},
 {beforeRunningCommand: "nop",
  command: 
   "#!/usr/bin/env ruby -wKU\n\ndef pretty(number)\n  number.to_s.gsub(/\\d{1,3}(?=\\d{3}+(?!\\d))/, '\\0,')\nend\n\ncounts = `wc -lwc`.scan(/\\d+/)\ncounts[0] = counts[0].to_i + 1 # increase one to the line count\n\n%w[ line word byte ].each do |unit|\n  cnt    = counts.shift\n  plural = cnt.to_i != 1 ? 's' : ''\n  printf(\"%11.11s %s%s\\n\", pretty(cnt), unit, plural)\nend\n",
  fallbackInput: "document",
  input: "selection",
  keyEquivalent: "^N",
  name: "Statistics for Document / Selection (Word Count)",
  output: "showAsTooltip",
  uuid: "AA202E76-8A0A-11D9-B85D-000D93589AF6"},
 {beforeRunningCommand: "nop",
  command: "iconv -c -f utf-8 -t ASCII//TRANSLIT",
  fallbackInput: "word",
  input: "selection",
  name: "Transliterate Word / Selection to ASCII",
  output: "replaceSelectedText",
  uuid: "3AA8A593-6E4C-11D9-91AF-000D93589AF6"}]
