You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Instantly share code, notes, and snippets.
💫
Learning bash scripting ⌨️ and python🐍. Thanks O'reilly!
alephalpha0
alephalpha0
💫
Learning bash scripting ⌨️ and python🐍. Thanks O'reilly!
A lone Space Cowboy perpetually gazing into his terminal, getting buzzed on the newest Protocols and broadcasting into the nether for anyone to hear.
🚀⭐
This SoC is mainly created so I could use the hub command to push a gist to GitHub. This would give me a lazy way to get onto GitHub, via the generated by hub link to the gist, without actually alt-tabing to FireFox.. All so I can search for some little whirly gig application that has now completely slipped from my memory.
First entry in a series on my first true bash script, one with a purpose.
Building a cli program flow in order to archive a single webpage or article.
The problem to be solved:
I have a desire to be able to, through the command line, download a single webpage into a self-contained .html file with the option to convert it to (or save alongside) other formats such as PDF, EPUB, or even md if possible. There are two main use-cases I want to offer: 1) get the entire webpage, strip out the ads/useless shit, and save the new version locally & 2) for journal/website articles, blog entries, or tutorials: simply save the main content and discard every other element from the source.
The inital idea for solution:
A bash script that takes in a URL and, through menu redirection, outputs the desired file(s) into a standard directory.
Why not use currently available methods:
I've come across quite a few programs and scripts that seem like they would be perfect for what I want to do, but unfortunately I'm using termux on an Android and most of them do not work
File header currently in use for bash scripts NOV2020 v2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
personal file header {license & warranty free} OCT 2020 - v1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Im messing about with images on terminal. This is just for future reference.
Using ImageMagick via CLI is esoteric but some google-fu sorted me out.
convert (originalfile) -resize ##% (outputfile) will resize an image by the percentage given. Better than using -scale as it keeps the image quality up. Replace ##% with HxW to make the image resize into dimensions that best fit H or W. eg, a 1024x768 original ran through -resize 80x80 will have width of 80 and height within ratio.
Converting from one imgage type to the next is simple as well. convert png myjpeg.jpg will convert myjpeg.jpg into a png.
Using jp2a as a neat tool to output images via ascii and ansi color codes into the terminal is fun and entertaining, but fleeting.
If I want to save the output for future use and display, I have two options. The first outputs html via jp2a . jp2a --zoom-term --colors --html (originalfile) > newfile.html will put the HTML output from jp2a into an html file. If, instead, I want to save the ansi codes and ascii decorations without formatting into html,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters