Skip to content

Instantly share code, notes, and snippets.

@imme5150
Created January 3, 2023 18:34
Show Gist options
  • Save imme5150/531f0c34cb58246699217e223f9563cb to your computer and use it in GitHub Desktop.
Save imme5150/531f0c34cb58246699217e223f9563cb to your computer and use it in GitHub Desktop.
require 'set'
# copy a string to the clipboard
def cp(string = IRB.CurrentContext.last_value)
IO.popen('xclip -sel clip', 'w') { |f| f << string.to_s }
string
end
if ARGV[0] && ARGV[0][0].downcase == 't'
@lines = "".split("\n")
elsif ARGV[0] && ARGV[0][0].downcase == 'c'
@lines = `xclip -o`.split("\n")
else
@lines = File.readlines("/home/shup/Desktop/input.txt").map &:chomp
end
# @lines = @lines.first.split(',')
# @lines = @lines.map(&:to_i)
c = 0
@lines.each_with_index do |l, row|
end
puts cp c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment