Using the API for Easy Command-Line Image Hosting

Like many of my fellow LowendTalk readers, I sometimes post images on LET and other boards.  To do that, I need an image hosting service.  Going through the work of logging into a web page, uploading through their interface, etc. is tedious.  Wouldn’t it be better to do it with an easy command-line script?  Indeed, and it’s quite easy.

As far as services, I’ve never liked Imgur and while I do like, they don’t have an API.  However, does and in about 15 minutes I had a script that allowed me to upload files and get a URL without any web browser interaction at all.

My requirements were that the script had to work on both Linux and macOS and not require any third-party modules because I didn’t want to have to keep them updated on different operating systems.  There are some nice Python scripts but they require the requests module (which is great, but is third-party).  Likewise while the right thing to do is parse the JSON response with something like jq, that’s a third-party dependency, so I’ll just munge it with a regex.

Here’s code showing how easy it is.

First, create an account on and then login with it.  Then visit and click “Get API Key”.

Here’s the script I’m using, which is modified from the example on their site:


# change this to your actual API KEY
RESPONSE=$(curl -s --location 
--request POST "${API_KEY}" 
--form "image=@"$1"")
URL=$(echo $RESPONSE | sed 's/^.*"display_url":"//' | sed 's/",.*$//')
URL=$(echo $URL | sed 's#\/#/#g')
echo $URL

All that’s needed for this script are bash, curl, and sed, which should be present on any modern Unix-like system.

Here’s the output:

$ ~/Dropbox/bin/ ~/Desktop/leb_logo.png

That URL is now suitable for use on any forum.



I’m Andrew, techno polymath and long-time LowEndTalk community Moderator. My technical interests include all things Unix, perl, python, shell scripting, and relational database systems. I enjoy writing technical articles here on LowEndBox to help people get more out of their VPSes.

bash – Rdoc – a command-line tool for launching documents (improved)

bash – Rdoc – a command-line tool for launching documents (improved) – Code Review Stack Exchange

Is there a program to remove trailing spaces and convert tabs to spaces in a lot of files at once using command-line?

I am using cygwin and have a lot of files in which I want to convert tabs to spaces and remove all space characters that exist at end of line. Is there a utility for this in Linux?

mac – How do I use the `security` command-line tool to change Access Control of a private key?

How do I use the security command-line tool to add an application to allow access to the private key or key chain? or change it to Allow all application to access this item? ›››››››enter image description here

(I am trying to do this to my CI machines which I don’t have GUI access)

malware – How to run exe upon logon with GPO (Commandline)

I am working on this keylogger project of mine. I have successfully implemented registry, scheduled tasks persistence but am stuck with GPO logon persistence. All online resources i saw are providing info on adding GPO in GUI. I need the command that can be run to register the EXE file in GPO logon. I located the feature i need in the GUI version of Group Policy Editor.
Local GP Editor - Run programs at logon

Can someone point me in the right direction on achieving my goal with commandline? Thanks.

Formatting code in .wl and .m files from the command-line?

I use an external editor (Sublime Text) to edit my .wl and .m files and run them with WolframKernel from the command line. This means everything I do is outside of Mathematica. Is there a way I can format a file using something like the official code formatter where I input the code in the file through the command line as standard input and receive the formatted text as standard output (something like cat /my/file.wl | formatting_util)? Thanks for reading.

Procedure for creating a command-line tool in C or C++ that includes all recommended packaging for all platforms

One reason I might want to create a command line tool in NodeJs is because I can follow simple procedure such as this:

And then I can tell people “go do npm install -g cooltool” and my cool tool is on their computer ready to be used from the command line, such as git or 7zip, place in the path and everything. And it’ll work on any computer NodeJS is on.

But I’d rather do this in C/C++. Is there a guide to do this such that one can write a simple console place application (with no dependencies), that will work on any platform. It’s okay if it’s limited to gcc and/or cmake for instance.

But what I would also like is have all the packaging “just work”, including publishing the packages in the places expected by users of the given platform. would that be apt-get? chocolatey? can it auto-create an msi or setup.exe? how about a dmg for osx?

I feel like this is a solved problem that someone must have already spent the time addressing. A programmer should be able to write a C file, compile it, and if it works, press a button and all the rest of the stuff just happens, packaging, etc.

This can perhaps even be a cloud service (I wouldn’t paying for it)

Modular Command-line Application in python

I have already written a simple python cmd program using the cmd module. However, I would like it to be modular. For Example, there would be a folder named script and any .py that contains a command would add the command to the application. How would I go about that?

I have figured out how to find and load modules that are within a folder using importlib.

hard drive – Will the dd disk clone commandline include partitions of various formats on macOS Catalina?

My original question was closed because it’s assumed this thread (What is the best way to clone a disk between two Macs?) answers my question, so I am rephrasing my question and title.

The author in the linked post makes no mention of whether he intends partitions to be copied (just “files”) and neither do the responses. Will “dd” accept the disk’s partitions, and its various volume formats? I have some 10 partitions, with some being HFS+, some APFS, one ExFAT. Will these formats also be copied with dd?

Would appreciate some help, thank you!

How do you open multiple videos with multiple subtitles in VLC from command-line?

Usually, you can use this command to open a video with a subtitle in VLC, if it isn’t detected automatically:
vlc.exe path_to_video.mp4 --sub-file

But I want to open multiple videos, each with their own subtitle file. How do I do that?
Neither vlc.exe video1.mp4 video2.mp4 --sub-file
nor vlc.exe video1.mp4 --sub-file video2.mp4 --sub-file seem to work.

DreamProxies - Cheapest USA Elite Private Proxies 100 Private Proxies 200 Private Proxies 400 Private Proxies 1000 Private Proxies 2000 Private Proxies - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive New Proxy Lists Every Day Proxies123