22 lines
594 B
Plaintext
22 lines
594 B
Plaintext
#! /usr/bin/env nix-shell
|
|
#! nix-shell -i ruby -p ruby -p rubyPackages.net-scp
|
|
|
|
require 'open3'
|
|
require 'pathname'
|
|
require 'securerandom'
|
|
require 'net/scp'
|
|
|
|
file = Pathname.new(ARGV[0])
|
|
new_name = SecureRandom.hex(12) + File.extname(file)
|
|
abort "Och komm." unless file.exist? and file.readable?
|
|
|
|
url = "https://drop.bascht.space/#{new_name}"
|
|
|
|
Net::SCP.start("drop.bascht.space", "bascht") do |scp|
|
|
scp.upload(file.expand_path.to_s, "/home/bascht/drop/#{new_name}")
|
|
end
|
|
|
|
system "wl-copy #{url}"
|
|
|
|
system("notify-send -t 1000 'Uploaded successfully' '<a href=\'#{url}\'>drop.bascht.space</a>'")
|