store files to filepicker.io from the command line? - command-line

I have a bunch of files, I'd like to push them all to filepicker and use various convert options to manipulate them.
How do I automate this process? Is there a way to do this outside of javascript with a traditional scripting language I can run from the command line?

The way to do this is as a POST to /api/store/S3 with the contents of the file. For instance
curl -F fileUpload=#test.html 'https://www.filepicker.io/api/store/S3?key={{apikey}}&filename=myCoolFile.html'
There are other tools that perform similar actions, such as https://github.com/uams/geturl, but the mechanism they use (posting to /api/path/storage) is out of date.
Overall, you can use this functionality, but the urls may change. We're fairly happy with the /api/store/[provider] syntax, but may change before release

Related

how to hide unnecessary html tags in perl cgi when running from command line?

I'm using perl version 5.18. I don't have a provision to upgrade perl to a newer version. When I pass the CGI query parameters from the command line, the script runs and works perfectly but it shows unnecessary HTML tags and other things (<!DOCTYPE html PUBLIC...), which I want to hide from terminals. Those are necessary to execute the script from a browser. So, without affecting the functionality of cgi when it runs from the browser, is there any easy way to get only necessary outputs when running from command line/ terminal?
The best approach here is to separate the data extraction from the presentation of the extracted data.
I would move the data extraction code into a module. You can then call that module from your CGI program and then wrap it in the appropriate layer of HTML.
You can then write a command-line version of your program that uses the same module to extract the correct data but which then wraps it in whatever text you want to use to display the data on the console.
Adding unwanted presentation layers (like your current HTML) is never a good idea. Best to rewrite from scratch to give what you want.
(If you're in a real rush though, there's one other approach that I might consider. Write a screen-scraper that scrapes your HTML page and extracts the data from that.)

create ssh-compatible vscode extension

I often run scripts on remote machines and sometimes create custom html dashboards to monitor progress. I was wondering if something like that would be better done taking advantage of vscode's ssh extension, which I use to edit files remotely anyway.
For example, I'd like to display a custom panel with information derived from a list of files in the remote server. My traditional approach would be to run a web server to get the file contents in some custom json format and create a custom html client to display the data. Would it be possible to skip the web server part and instead create some custom vscode extension that gets the data via some ssh api?
It might be your case to use LogTail extension to fetch your data and then proceed with your desired display method.
VSCode Marketplace for LogTail: https://marketplace.visualstudio.com/items?itemName=tiansin.logtail
I hope it helps :)

Building an automated script to copy a page of text, translate it in Google Translator and paste it in Word

So, as the title says, I would like to make an automated script that is going to take all the text from one PDF page, copy it, paste it into Google Translate and then copy the translated text into another Microsoft Word document.
Since that PDF has a lot of pages (150+), I thought it may be easier to make an automated script to do that.
What language would I have to use, would it be complicated for me to do it and in the end, will I actually save time by using this script (implying that I have to learn it first, but I have some programming experience (I know C++, Javascript, PHP), but I do not have a strong grasp of algorithms (like Flood Fill, ...))?
Thanks in advance!
EDIT : I found that I could use AutoIt for scripting... but I don't know would I be better off using AutoIt or Powershell... I also want to learn something that would be enable me to create other scripts (for example to automate some processes I do in Camtasia Studio)... So, AutoIt or Powershell?
As an AutoIt user I would say AutoIt.
Copying text out of PDFs is not quite as simple as you might imagine. Mileage will vary on how the PDF was created, and there are several methods you can use:
Most PDFs will have most of the text in the file itself, allowing you to get the text using a simple method like this
This method uses zlib to do something to the pdf. Not sure what as I've never tried it.
There are a variety of examples of using third party programs to do this, which may be better. There is one using Debenu and another using XPDF
Automating other programs such as acrobat should be possible, in acrobats case they have an api that can be used, though I'm not aware of this already being wrapped in AutoIt.
As to the rest of the requirements, there is a UDF to translate with google translate here, and the word UDF is a standard one that comes with the AutoIt installation.

how do I set a Thunderbird signature to use a dynamic url's html?

I want to use a dynamic email signature in Thunderbird, that is context aware (depends on date, events in db, etc.)
If I have a PHP that can generate the signature html (i.e. http://www.site.com/email_sign.php)
how do I force Thunderbird to use it?
(the only options I see are using static html (whether inline, of from a local system file).
any ideas?
You can use the Signature Switch add-on and a batch file calling wget to achieve what you want. I wrote a simple executable to replace the bat file; you can read about it (and download it if you want to) from http://www.else.co.nz/portfolio/020-code/dynamic-email-signatures
I doubt you can do this simply. Thunderbird does allow scripting via the creation of plugins but I wouldn't personally know how do do it or how easy it might be.
Best answer I can think of would be to set a scheduled task / cron job to download the php to a local file then follow the instructions in the knowledge base, namely:
You can use Thunderbird to create signature files, or you can use your operating system tools to create them—for example, a plain text editor.
Thunderbird does not provide any
special place to store signature
files. You could create a Signatures
directory in your profile to store
them, making them easy to back up
along with the rest of your profile.
Or you could store them somewhere
else.
To use a signature file, specify it in
Account Settings as the signature for
an identity. Check the box "Attach the
signature from a file instead" and
specify the signature file.
This will work unless Thunderbird caches the HTML internally, however I see no indication in the FAQ that this is the case.
For years I updated the signature for my email client manually – until I got fed up… That’s why I wrote a PHP script to create a randomized signature block automatically from an RSS feed! Check it out: https://github.com/birdy1976/signature :-D

Options to create editable graph or scheme with Perl?

I'm searching for a way to create complex/simple graph using Perl.
The known modules/applications I've checked are: GraphViz, Graph-Easy, aiSee etc.
Each way I walked, new problems appeared.
If my need is to create graph dependencies that
can be edited live
have a directed compass mode
work fine and are readable with massive data use
can be used through the terminal to convert from input format (GDL etc.) to output format (PNG, BMP, HTML etc.) –
what are the various applications that can handle all of these requests?
This question is a follow-up of How can I convert connection data lines to block of schemes using Perl?.
Thanks,
YoDar.
It might be an overkill for your application, but you might also want to look into PerlMagik.