<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ujjawal Saini</title>
    <description>The latest articles on DEV Community by Ujjawal Saini (@spignelon).</description>
    <link>https://dev.to/spignelon</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F951978%2Fd4ecf1ae-2555-43f5-9ed8-cc7806d8dcc2.jpeg</url>
      <title>DEV Community: Ujjawal Saini</title>
      <link>https://dev.to/spignelon</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/spignelon"/>
    <language>en</language>
    <item>
      <title>Uploading files from terminal on file hosting service, and unlimited cloud storage</title>
      <dc:creator>Ujjawal Saini</dc:creator>
      <pubDate>Mon, 15 May 2023 14:29:01 +0000</pubDate>
      <link>https://dev.to/spignelon/uploading-files-from-terminal-on-file-hosting-service-and-unlimited-cloud-storage-3j1</link>
      <guid>https://dev.to/spignelon/uploading-files-from-terminal-on-file-hosting-service-and-unlimited-cloud-storage-3j1</guid>
      <description>&lt;p&gt;In this post I will show you how you can upload files anonymously  directly from your terminal, and can have unlimited cloud storage all for free.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;BayFiles is a website and file hosting service created by two of the founders of The Pirate Bay.&lt;br&gt;
BayFiles works by letting users upload files to its servers and share them online. Users are provided with a link to access their files, which can be shared with anyone on the internet so that they can download the files associated with the particular link. A unique aspect of this file hosting service is that it does not provide a search function for its users or any sort of file directory that could be used to navigate its online file base. BayFiles can be used and accessed by people without requiring them to sign up for it.&lt;/em&gt;&lt;br&gt;
Source: &lt;a href="https://en.wikipedia.org/wiki/BayFiles"&gt;Wikipedia&lt;/a&gt;&lt;br&gt;
Another similar popular service is &lt;a href="https://anonfiles.com/"&gt;anonfiles&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Searching for the API
&lt;/h2&gt;

&lt;p&gt;As you can see when you open the &lt;a href="https://anonfiles.com/"&gt;anonfiles.com&lt;/a&gt;, there is an option of API at the bottom of the page.&lt;br&gt;
&lt;a href="https://anonfiles.com/docs/api"&gt;https://anonfiles.com/docs/api&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Understanding the API
&lt;/h2&gt;

&lt;p&gt;The request example under upload in the aforementioned link is:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;curl -F "file=@test.txt" https://api.anonfiles.com/upload&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;So as we can see in the above command they're using curl. curl  is  a  tool  for transferring data from or to a server. We also need to replace test.txt with the name of the file we want to upload.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing curl
&lt;/h2&gt;

&lt;p&gt;You can use package manager on the distro of your choice to install curl.&lt;br&gt;
For Ubuntu/Debian based distros:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo apt-get install curl&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;For Arch Linux:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo pacman -S curl&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Many linux distros comes with curl preinstalled. To check the version of curl installed on your system type:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;curl -V&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Uploading files
&lt;/h2&gt;

&lt;p&gt;For demonstration I am going to upload a file named "26bugc.jpg"&lt;br&gt;
You would also need to change the current directory to the directory where the file you want to upload is stored.&lt;br&gt;
The file I am uploading is stored in my home directory.&lt;/p&gt;

&lt;p&gt;Replacing the test.txt with the file name:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;curl -F "file=@26bugc.jpg" https://api.anonfiles.com/upload&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;{"status":true,"data":{"file":{"url":{"full":"https://anonfiles.com/f7LaKftby3/26bugc_jpg","short":"https://anonfiles.com/f7LaKftby3"},"metadata":{"id":"f7LaKftby3","name":"26bugc.jpg","size":{"bytes":97116,"readable":"97.12 KB"}}}}}&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--icnpnjdf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://i.imgur.com/joHGYx8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--icnpnjdf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://i.imgur.com/joHGYx8.png" alt="screenshot" width="800" height="90"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The full and short URL above are the link to our uploaded file.&lt;br&gt;
Full: &lt;a href="https://anonfiles.com/f7LaKftby3/26bugc_jpg"&gt;https://anonfiles.com/f7LaKftby3/26bugc_jpg&lt;/a&gt;&lt;br&gt;
Short: &lt;a href="https://anonfiles.com/f7LaKftby3"&gt;https://anonfiles.com/f7LaKftby3&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;a href="https://anonfiles.com/faq"&gt;Frequently Asked Questions&lt;/a&gt;:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;How long will my files be online?&lt;/strong&gt;&lt;br&gt;
For as long as possible unless the file violates our Terms of Use.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are the limit of uploads?&lt;/strong&gt;&lt;br&gt;
You are free to upload as long as you don't exceed the following restrictions:&lt;br&gt;
Max 20 GB per file&lt;br&gt;
Max 500 files or 50 GB per hour.&lt;br&gt;
Max 5,000 files or 100 GB per day.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Any restrictions on downloads?&lt;/strong&gt;&lt;br&gt;
No. We do not enforce any form of bandwidth limitations on downloads.&lt;/p&gt;
&lt;h2&gt;
  
  
  Similar / Alternatives
&lt;/h2&gt;

&lt;p&gt;I have curated similar websites, which works exactly like the one we saw above:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://anonfiles.com/"&gt;anonfiles&lt;/a&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;curl -F "file=@test.txt" https://api.anonfiles.com/upload&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://bayfiles.com/"&gt;BayFiles&lt;/a&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;curl -F "file=@test.txt" https://api.bayfiles.com/upload&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://openload.cc/"&gt;openload&lt;/a&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;curl -F "file=@test.txt" https://api.openload.cc/upload&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://lolabits.se/"&gt;Lolabits&lt;/a&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;curl -F "file=@test.txt" https://api.lolabits.se/upload&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://vshare.is/"&gt;vShare&lt;/a&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;curl -F "file=@test.txt" https://api.vshare.is/upload&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://hotfile.io/"&gt;hotfile&lt;/a&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;curl -F "file=@test.txt" https://api.hotfile.io/upload&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://rapidshare.nu/"&gt;Rapidshare&lt;/a&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;curl -F "file=@test.txt" https://api.rapidshare.nu/upload&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://upvid.cc/"&gt;Upvid&lt;/a&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;curl -F "file=@test.txt" https://api.upvid.cc/upload&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://letsupload.cc/"&gt;Letsupload&lt;/a&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;curl -F "file=@test.txt" https://api.letsupload.cc/upload&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://megaupload.nz/"&gt;Megaupload&lt;/a&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;curl -F "file=@test.txt" https://api.megaupload.nz/upload&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://myfile.is/"&gt;MYfile&lt;/a&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;curl -F "file=@test.txt" https://api.myfile.is/upload&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://filechan.org/"&gt;filechan&lt;/a&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;curl -F "file=@test.txt" https://api.filechan.org/upload&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Each of these privacy oriented file hosting service is absolutely free, has no time limit, provides unlimited bandwidth, 20GB filesize limit, and unlimited file storage. You can also upload files on these websites directly from your browser of use your terminal like we've learnt above. Although these files are not listed anywhere and cannot be accessed by anyone on the internet without the link, if you want to upload some private and personal files consider encrypting them before uploading so only you can access them.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>linuxtricks</category>
      <category>upload</category>
      <category>terminal</category>
    </item>
    <item>
      <title>Auto-updating hosts file using cronjob</title>
      <dc:creator>Ujjawal Saini</dc:creator>
      <pubDate>Wed, 08 Mar 2023 15:46:31 +0000</pubDate>
      <link>https://dev.to/spignelon/auto-updating-hosts-file-using-cronjob-2fdc</link>
      <guid>https://dev.to/spignelon/auto-updating-hosts-file-using-cronjob-2fdc</guid>
      <description>&lt;p&gt;In this post I will show you how you can easily set your hosts file in "/etc/hosts" to automatically update with the help of cron.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is cron?
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;cron is the time-based job scheduler in Unix-like computer operating systems. cron enables users to schedule jobs (commands or shell scripts) to run periodically at certain times, dates or intervals. It is commonly used to automate system maintenance or administration.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Cron on Your System
&lt;/h2&gt;

&lt;p&gt;You can use package manager on the distro of your choice to install cron.&lt;br&gt;
For Ubuntu/Debian based distros:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo apt install cron&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;For Arch Linux:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo pacman -S cronie&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;For Fedora:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo dnf install cronie&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Enabling cron daemon to run on boot
&lt;/h2&gt;



&lt;p&gt;&lt;code&gt;sudo systemctl enable cronie&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;For Ubuntu/Debian based:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo systemctl enable cron&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Crontab format
&lt;/h2&gt;

&lt;p&gt;The basic format for a crontab is:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;minute hour day_of_month month day_of_week command&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;minute: values can be from 0 to 59.&lt;/li&gt;
&lt;li&gt;hour: values can be from 0 to 23.&lt;/li&gt;
&lt;li&gt;day_of_month: values can be from 1 to 31.&lt;/li&gt;
&lt;li&gt;month: values can be from 1 to 12.&lt;/li&gt;
&lt;li&gt;day_of_week: values can be from 0 to 6, with 0 denoting Sunday.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now if we want to run a command every Monday at 5:00pm we use:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;0 17 * * 1 command&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 ( 17 is 5pm in 24 hour clock format ).&lt;br&gt;
You can use &lt;a href="https://cron.help/"&gt;cron.help&lt;/a&gt; for more help to understand the syntax.&lt;/p&gt;
&lt;h2&gt;
  
  
  Setting up your cronjob using crontab
&lt;/h2&gt;

&lt;p&gt;We will use sudo for this since it requires root privilege to edit "/etc/hosts" file.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo crontab -e&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;I personally use &lt;a href="https://github.com/StevenBlack/hosts"&gt;StevenBlack&lt;/a&gt;'s hosts file to block advertisements and malicious domains so I would use:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;0 17 * * 1 curl https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts &amp;gt; /etc/hosts&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;The above command will fetch the updated hosts file every Monday at 5:00pm using curl from the above URL and overwrite the current "/etc/hosts" file.&lt;br&gt;
After adding the above command, save and exit crontab editor.&lt;/p&gt;




&lt;p&gt;This blog was originally written on June 18, 2022.&lt;br&gt;
URL: &lt;a href="https://paper.wf/spignelon/auto-updating-hosts-file-using-cronjob"&gt;https://paper.wf/spignelon/auto-updating-hosts-file-using-cronjob&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cron</category>
      <category>cronjob</category>
      <category>linux</category>
      <category>hosts</category>
    </item>
  </channel>
</rss>
