From ccc47fb6d9bcd72c98ce2d6234e04a5df8bcd9c8 Mon Sep 17 00:00:00 2001 From: murtezayesil Date: Thu, 13 Aug 2020 15:31:16 +0600 Subject: [PATCH] publish: Resizing 2500 photos --- content/Tech/resizing_2500_photos.md | 97 ++++++++++++ output/archives.html | 2 + output/author/ali-murteza-yesil2.html | 16 ++ output/authors.html | 2 +- output/categories.html | 2 +- output/category/tech.html | 16 ++ output/feeds/atom.xml | 86 ++++++++++- output/feeds/rss.xml | 2 +- output/feeds/tech.atom.xml | 86 ++++++++++- output/index2.html | 16 ++ output/resizing-2500-photos.html | 214 ++++++++++++++++++++++++++ output/tag/100daystooffload2.html | 16 ++ output/tag/code.html | 23 ++- output/tags.html | 4 +- 14 files changed, 573 insertions(+), 9 deletions(-) create mode 100644 content/Tech/resizing_2500_photos.md create mode 100644 output/resizing-2500-photos.html diff --git a/content/Tech/resizing_2500_photos.md b/content/Tech/resizing_2500_photos.md new file mode 100644 index 0000000..2995e08 --- /dev/null +++ b/content/Tech/resizing_2500_photos.md @@ -0,0 +1,97 @@ +title: Resizing 2500 photos +date: 2020-07-13 07:19 +tags: code, 100DaysToOffload +summary: We needed to resize 2500 photographs for a website. There is a shell script for that. +status: published +comment: +hundreddaystooffload: 18 + +I was asked to write a program to resize thousands of images which were gonna be uploaded to a website. Images had to be the same height for them to look organized in gallery. I remembered how I used [imagemagick](https://imagemagick.org/) to write [desktop-clock](https://gitlab.com/murtezayesil/student/-/tree/master/sh/desktop-clock "use imagemagick, figlet and feh for tty-clock on wallpaper"), immitate tty-clock on wallpaper. That experience helped me to design the program in my mind as we continue to speak on the phone. + +``` sh +/‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾\ +| for each image | +| do resize to height=800 | +\___________________________/ + O + o \_\_ _/_/ + . \__/ + (oo)\_______ + (__)\ )\/\ + ||----w | + || || +``` + +# This is a learning opportunity +Since I don't have much of an experience on shell scripting, I was [Duck](https://start.duckduckgo.com/ "DuckDuckGo")ing everything. I learned to do few things during this task. + +1. [For loops in shell script](https://duckduckgo.com/?q=for+loop+shell+script "There are many tutorials") +2. Getting [list of files](https://stackoverflow.com/questions/2437452/how-to-get-the-list-of-files-in-a-directory-in-a-shell-script "I didn't know how to use asteriks 😅️") +3. Correct syntax for [resizing with ImageMagick](https://imagemagick.org/script/convert.php "It ain't magick but it quiet is 😉️") + +After reading tutorials and looking at examples everything felt as simple as lego. I just needed to put them together. + +Here is `image_shrinker.v0.1_alpha.sh` : + +``` sh +#!/bin/sh +mkdir ../output +for image in ./* +do + convert $image -scale 1000000x800 ../output/$image +done +``` + +This version has problems which I can't call "feature" 😁️ : + +0. Resolution is hard coded. Btw, only way to define resolution is in WIDTHxHEIGHT format AFAIK. +1. Script must be in same directory as images +2. PWD must point to the directory where script is + +## Adjustable resolution +``` sh +#!/bin/sh +mkdir ../output +WIDTH=$1 ; HEIGHT=$2 + +for image in ./* +do + convert $image -scale $WIDTHx$HEIGHT ../output/$image +done +``` +This fixes the hard coded resolution problem but new problem is that the user has to know that WIDTH and HEIGHT must be given. I fix that by showing correct syntax to the user and then exiting : + +``` sh +#!/bin/sh + +if [ $# -lt 2 ] +then + echo "USAGE:" + echo -e "\t\$IMAGE_DIRECTORY/image_shrinker.sh WIDTH HEIGHT" + exit 1 +fi + +WIDTH=$1 ; HEIGHT=$2 +mkdir ../output + +for image in * +do + convert $image -scale $Resolution ../output/$image +done +``` + +Here is some other attempt to make code a bit more flexible in terms of where images can be and where output can go. Actually no but that is what I was going for 😜️ + +``` sh +#!/bin/sh + +DIR=`pwd` + +for image in ./*.* +do +# Below code will scale images to 800px height without breaking aspect ratio + convert $DIR/$image -scale 10000x800 -write $DIR/../output/$image +done +``` + +It is hard to ask for help (especially after torturing with my code) but if you would like to give me feedback and advice, reply to toot of this post. diff --git a/output/archives.html b/output/archives.html index 95ef0d4..aaa9f17 100644 --- a/output/archives.html +++ b/output/archives.html @@ -81,6 +81,8 @@
Digital Cleansing - NextCloud
Tue 14 July 2020
Digital Cleansing - Identifying services we use
+
Mon 13 July 2020
+
Resizing 2500 photos
Sun 12 July 2020
Digital Cleansing For Better Privacy
Fri 10 July 2020
diff --git a/output/author/ali-murteza-yesil2.html b/output/author/ali-murteza-yesil2.html index ec5cba5..73d01c8 100644 --- a/output/author/ali-murteza-yesil2.html +++ b/output/author/ali-murteza-yesil2.html @@ -127,6 +127,22 @@ | tags: digitalcleansingprivacy100daystooffload | Day 3 of #100DaysToOffload + + + +
  • diff --git a/output/authors.html b/output/authors.html index 3257f78..c15fe50 100644 --- a/output/authors.html +++ b/output/authors.html @@ -49,7 +49,7 @@
    -

    Authors on Ali Murteza Yesil

  • Ali Murteza Yesil (17)
  • +

    Authors on Ali Murteza Yesil

  • Ali Murteza Yesil (18)
  • diff --git a/output/categories.html b/output/categories.html index 6632b61..384467f 100644 --- a/output/categories.html +++ b/output/categories.html @@ -51,7 +51,7 @@
    diff --git a/output/category/tech.html b/output/category/tech.html index 9f5db9e..3571d9a 100644 --- a/output/category/tech.html +++ b/output/category/tech.html @@ -241,6 +241,22 @@ You can't play songs from your Spotify account either. Songs on Spotify/Apple Mu | tags: digitalcleansingprivacy100daystooffload | Day 3 of #100DaysToOffload +
    + + +
  • diff --git a/output/feeds/atom.xml b/output/feeds/atom.xml index 67669ea..b668c6d 100644 --- a/output/feeds/atom.xml +++ b/output/feeds/atom.xml @@ -551,7 +551,91 @@ This list may get longer as I remember services I subscribed to but didn't use i I will start with looking for alternatives to Google Drive.</p> <p>If there is any other service you think I should stay away from, you can write to comment toot.<br> If you have written a blog post as an answer, mention that too.<br> -If you think some of the services or softwares I mentioned here aren't that bad and I would be better of keep using them, please share why you think so. I want to keep an open mind and look at those services from your perspective too.</p>Digital Cleansing For Better Privacy2020-07-12T00:07:00+06:002020-07-12T00:07:00+06:00Ali Murteza Yesiltag:murtezayesil.me,2020-07-12:/digital-cleansing-for-better-privacy.html<p>I am documenting my journey to claiming my digital freedom. Previously called "My Master Plan For Privacy (of my family)".</p><p>I previously wrote about <a href="privacy_for_the_whole_family.md" title="Privacy For The Whole Family">how I got became more privacy caring individual</a> and I tooted about <a href="https://fosstodon.org/@murtezayesil/104480280886518081">My Master Plan for Privacy of My Family</a>. As I grew up, I came to realize how much we gave up on privacy for the convinience and "free" services. We are social creatures. I was using Google Photos, WhatsApp, Youtube and Instagram as much as I could and my family is doing the same. We are putting each other's privacy at stake by uploading data about each other without knowing. I decided to change that either by finding privacy focused alternatives to digital services I was using or by build server system to offer alternatives myself.</p> +If you think some of the services or softwares I mentioned here aren't that bad and I would be better of keep using them, please share why you think so. I want to keep an open mind and look at those services from your perspective too.</p>Resizing 2500 photos2020-07-13T07:19:00+06:002020-07-13T07:19:00+06:00Ali Murteza Yesiltag:murtezayesil.me,2020-07-13:/resizing-2500-photos.html<p>We needed to resize 2500 photographs for a website. There is a shell script for that.</p><p>I was asked to write a program to resize thousands of images which were gonna be uploaded to a website. Images had to be the same height for them to look organized in gallery. I remembered how I used <a href="https://imagemagick.org/">imagemagick</a> to write <a href="https://gitlab.com/murtezayesil/student/-/tree/master/sh/desktop-clock" title="use imagemagick, figlet and feh for tty-clock on wallpaper">desktop-clock</a>, immitate tty-clock on wallpaper. That experience helped me to design the program in my mind as we continue to speak on the phone.</p> +<div class="highlight"><pre><span></span><code>/‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾<span class="se">\ </span> +<span class="p">|</span> <span class="k">for</span> each image <span class="p">|</span> +<span class="p">|</span> <span class="k">do</span> resize to <span class="nv">height</span><span class="o">=</span><span class="m">800</span> <span class="p">|</span> +<span class="se">\_</span>__________________________/ + O + o <span class="se">\_\_</span> _/_/ + . <span class="se">\_</span>_/ + <span class="o">(</span>oo<span class="o">)</span><span class="se">\_</span>______ + <span class="o">(</span>__<span class="o">)</span><span class="se">\ </span> <span class="o">)</span><span class="se">\/\</span> + <span class="o">||</span>----w <span class="p">|</span> + <span class="o">||</span> <span class="o">||</span> +</code></pre></div> + + +<h1>This is a learning opportunity</h1> +<p>Since I don't have much of an experience on shell scripting, I was <a href="https://start.duckduckgo.com/" title="DuckDuckGo">Duck</a>ing everything. I learned to do few things during this task.</p> +<ol> +<li><a href="https://duckduckgo.com/?q=for+loop+shell+script" title="There are many tutorials">For loops in shell script</a></li> +<li>Getting <a href="https://stackoverflow.com/questions/2437452/how-to-get-the-list-of-files-in-a-directory-in-a-shell-script" title="I didn't know how to use asteriks 😅️">list of files</a></li> +<li>Correct syntax for <a href="https://imagemagick.org/script/convert.php" title="It ain't magick but it quiet is 😉️">resizing with ImageMagick</a></li> +</ol> +<p>After reading tutorials and looking at examples everything felt as simple as lego. I just needed to put them together. </p> +<p>Here is <code>image_shrinker.v0.1_alpha.sh</code> :</p> +<div class="highlight"><pre><span></span><code><span class="ch">#!/bin/sh</span> +mkdir ../output +<span class="k">for</span> image in ./* +<span class="k">do</span> + convert <span class="nv">$image</span> -scale 1000000x800 ../output/<span class="nv">$image</span> +<span class="k">done</span> +</code></pre></div> + + +<p>This version has problems which I can't call "feature" 😁️ :</p> +<ol> +<li>Resolution is hard coded. Btw, only way to define resolution is in WIDTHxHEIGHT format AFAIK.</li> +<li>Script must be in same directory as images</li> +<li>PWD must point to the directory where script is</li> +</ol> +<h2>Adjustable resolution</h2> +<div class="highlight"><pre><span></span><code><span class="ch">#!/bin/sh</span> +mkdir ../output +<span class="nv">WIDTH</span><span class="o">=</span><span class="nv">$1</span> <span class="p">;</span> <span class="nv">HEIGHT</span><span class="o">=</span><span class="nv">$2</span> + +<span class="k">for</span> image in ./* +<span class="k">do</span> + convert <span class="nv">$image</span> -scale <span class="nv">$WIDTHx$HEIGHT</span> ../output/<span class="nv">$image</span> +<span class="k">done</span> +</code></pre></div> + + +<p>This fixes the hard coded resolution problem but new problem is that the user has to know that WIDTH and HEIGHT must be given. I fix that by showing correct syntax to the user and then exiting :</p> +<div class="highlight"><pre><span></span><code><span class="ch">#!/bin/sh</span> + +<span class="k">if</span> <span class="o">[</span> <span class="nv">$#</span> -lt <span class="m">2</span> <span class="o">]</span> +<span class="k">then</span> + <span class="nb">echo</span> <span class="s2">&quot;USAGE:&quot;</span> + <span class="nb">echo</span> -e <span class="s2">&quot;\t\$IMAGE_DIRECTORY/image_shrinker.sh WIDTH HEIGHT&quot;</span> + <span class="nb">exit</span> <span class="m">1</span> +<span class="k">fi</span> + +<span class="nv">WIDTH</span><span class="o">=</span><span class="nv">$1</span> <span class="p">;</span> <span class="nv">HEIGHT</span><span class="o">=</span><span class="nv">$2</span> +mkdir ../output + +<span class="k">for</span> image in * +<span class="k">do</span> + convert <span class="nv">$image</span> -scale <span class="nv">$Resolution</span> ../output/<span class="nv">$image</span> +<span class="k">done</span> +</code></pre></div> + + +<p>Here is some other attempt to make code a bit more flexible in terms of where images can be and where output can go. Actually no but that is what I was going for 😜️</p> +<div class="highlight"><pre><span></span><code><span class="ch">#!/bin/sh</span> + +<span class="nv">DIR</span><span class="o">=</span><span class="sb">`</span><span class="nb">pwd</span><span class="sb">`</span> + +<span class="k">for</span> image in ./*.* +<span class="k">do</span> +<span class="c1"># Below code will scale images to 800px height without breaking aspect ratio</span> + convert <span class="nv">$DIR</span>/<span class="nv">$image</span> -scale 10000x800 -write <span class="nv">$DIR</span>/../output/<span class="nv">$image</span> +<span class="k">done</span> +</code></pre></div> + + +<p>It is hard to ask for help (especially after torturing with my code) but if you would like to give me feedback and advice, reply to toot of this post.</p>Digital Cleansing For Better Privacy2020-07-12T00:07:00+06:002020-07-12T00:07:00+06:00Ali Murteza Yesiltag:murtezayesil.me,2020-07-12:/digital-cleansing-for-better-privacy.html<p>I am documenting my journey to claiming my digital freedom. Previously called "My Master Plan For Privacy (of my family)".</p><p>I previously wrote about <a href="privacy_for_the_whole_family.md" title="Privacy For The Whole Family">how I got became more privacy caring individual</a> and I tooted about <a href="https://fosstodon.org/@murtezayesil/104480280886518081">My Master Plan for Privacy of My Family</a>. As I grew up, I came to realize how much we gave up on privacy for the convinience and "free" services. We are social creatures. I was using Google Photos, WhatsApp, Youtube and Instagram as much as I could and my family is doing the same. We are putting each other's privacy at stake by uploading data about each other without knowing. I decided to change that either by finding privacy focused alternatives to digital services I was using or by build server system to offer alternatives myself.</p> <p>I am not the first to do this. There are many privacy friendly alternatives developed by people who care about privacy. It isn't hard to find those <a href="https://alternativeto.net/" title="Crowdsourced Software Recomendations">alternatives</a>. Many people went through this journey, which I call "Digital Cleansing For Better Privacy". During my journey, I will document the steps I have taken and write my thoughts about the alternatives I tried.</p> <hr> <h1>Digital Cleansing For Better Privacy</h1> diff --git a/output/feeds/rss.xml b/output/feeds/rss.xml index d42281c..7b9e3f5 100644 --- a/output/feeds/rss.xml +++ b/output/feeds/rss.xml @@ -1,2 +1,2 @@ -Ali Murteza Yesilhttps://murtezayesil.me/BlogTue, 11 Aug 2020 18:29:00 +0600Switching to Bluetooth earphoneshttps://murtezayesil.me/switching-to-bluetooth-earphones.html<p>After I droped my phone and broke its headphone jack, I had to switch to bluetooth earphone. Redmi Airdots is my choice thanks to its price.</p>Ali Murteza YesilTue, 11 Aug 2020 18:29:00 +0600tag:murtezayesil.me,2020-08-11:/switching-to-bluetooth-earphones.htmlPersonal100DaysToOffloadYet Another Last Hop Attempthttps://murtezayesil.me/yet-another-last-hop-attempt.html<p>Solus 4.1 was one of the best polished experiences I had. I hope it continues that way and I don't feel the need for a hop.</p>Ali Murteza YesilSun, 09 Aug 2020 22:00:00 +0600tag:murtezayesil.me,2020-08-09:/yet-another-last-hop-attempt.htmlPersonaldistros100DaysToOffloadMy Linux Journeyhttps://murtezayesil.me/my-linux-journey.html<p>Like many other distro hoppers, I tried many distros. Solus was one of the best polished experiences. That is not to say it is perfect.</p>Ali Murteza YesilFri, 07 Aug 2020 23:59:00 +0600tag:murtezayesil.me,2020-08-07:/my-linux-journey.htmlPersonaldistros100DaysToOffloadMarble League 2020https://murtezayesil.me/marble-league-2020.html<p>I am not like interested in sports. But I find Jelle's Marble Runs silly. That is a solid reason to love something 😅️</p>Ali Murteza YesilWed, 05 Aug 2020 11:11:00 +0600tag:murtezayesil.me,2020-08-05:/marble-league-2020.htmlPersonal100DaysToOffloadDigital Cleansing - Musichttps://murtezayesil.me/digital-cleansing-music.html<p>There aren't many options to buy DRM free music, are there!</p>Ali Murteza YesilMon, 03 Aug 2020 15:00:00 +0600tag:murtezayesil.me,2020-08-03:/digital-cleansing-music.htmlTechdigitalcleansingmusic100DaysToOffloadSwap on SSD done righthttps://murtezayesil.me/swap-on-ssd-done-right.html<p>SSDs are fragile and swaps can be damaging. But they can live happily together.</p>Ali Murteza YesilSat, 01 Aug 2020 12:00:00 +0600tag:murtezayesil.me,2020-08-01:/swap-on-ssd-done-right.htmlTech100DaysToOffloadSilent Rage Quitshttps://murtezayesil.me/silent-rage-quits.html<p>nobody saw it coming</p>Ali Murteza YesilThu, 30 Jul 2020 16:49:00 +0600tag:murtezayesil.me,2020-07-30:/silent-rage-quits.htmlPersonal100DaysToOffloadDecentralized Internet is More Reliablehttps://murtezayesil.me/decentralized-internet-is-more-reliable.html<p>Every system is prone to failure and will face down time. Decentralization avoids total system failure.</p>Ali Murteza YesilTue, 28 Jul 2020 12:00:00 +0600tag:murtezayesil.me,2020-07-28:/decentralized-internet-is-more-reliable.htmlTech100DaysToOffloadDeleting Amazon accounthttps://murtezayesil.me/deleting-amazon-account.html<p>Deleting Amazon account has more steps (friction) than I would like. But not impossible.</p>Ali Murteza YesilSun, 26 Jul 2020 21:15:00 +0600tag:murtezayesil.me,2020-07-26:/deleting-amazon-account.htmlNotes100DaysToOffloadDigital Cleansing - Mastodonhttps://murtezayesil.me/digital-cleansing-mastodon.html<p>Centralized microblogging platforms are rich in user data and attractive to cyber criminals. I recommend decentralized alternatives.</p>Ali Murteza YesilFri, 24 Jul 2020 15:23:00 +0600tag:murtezayesil.me,2020-07-24:/digital-cleansing-mastodon.htmlTechdigitalcleansingprivacyfediverse100DaysToOffload$ADB_VENDOR_KEYS is not sethttps://murtezayesil.me/adb_vendor_keys-is-not-set.html<p>Authorizing adb when no prompt will come, the hard way.</p>Ali Murteza YesilWed, 22 Jul 2020 00:00:00 +0600tag:murtezayesil.me,2020-07-22:/adb_vendor_keys-is-not-set.htmlNotesandroidproblem100DaysToOffloadFizzBuzz with single semicolonhttps://murtezayesil.me/fizzbuzz-with-single-semicolon.html<p>Attempt to write an eccentric FizzBuzz program with as few semicolon as possible.</p>Ali Murteza YesilMon, 20 Jul 2020 00:00:00 +0600tag:murtezayesil.me,2020-07-20:/fizzbuzz-with-single-semicolon.htmlNotescode100DaysToOffloadDigital Cleansing - Jitsihttps://murtezayesil.me/digital-cleansing-jitsi.html<p>My family and relatives live different countries and make good use of video calling services regardless of who is offering the service</p>Ali Murteza YesilSat, 18 Jul 2020 00:00:00 +0600tag:murtezayesil.me,2020-07-18:/digital-cleansing-jitsi.htmlTechdigitalcleansingprivacyjitsi100DaysToOffloadDigital Cleansing - NextCloudhttps://murtezayesil.me/digital-cleansing-nextcloud.html<p>NextCloud has 4 things going for me. It is FOSS, it gives me control, it is convenient and it works.</p>Ali Murteza YesilThu, 16 Jul 2020 10:00:00 +0600tag:murtezayesil.me,2020-07-16:/digital-cleansing-nextcloud.htmlTechdigitalcleansingprivacynextcloud100DaysToOffloadDigital Cleansing - Identifying services we usehttps://murtezayesil.me/digital-cleansing-identifying-services-we-use.html<p>Step 1 of digital cleansing is identifying services I want to drop</p>Ali Murteza YesilTue, 14 Jul 2020 03:40:00 +0600tag:murtezayesil.me,2020-07-14:/digital-cleansing-identifying-services-we-use.htmlTechdigitalcleansingprivacy100daystooffloadDigital Cleansing For Better Privacyhttps://murtezayesil.me/digital-cleansing-for-better-privacy.html<p>I am documenting my journey to claiming my digital freedom. Previously called "My Master Plan For Privacy (of my family)".</p>Ali Murteza YesilSun, 12 Jul 2020 00:07:00 +0600tag:murtezayesil.me,2020-07-12:/digital-cleansing-for-better-privacy.htmlTechdigitalcleansingprivacy100DaysToOffloadPrivacy For The Whole Familyhttps://murtezayesil.me/privacy-for-the-whole-family.html<p>My story of learning about wounds in my privacy and my first steps to cure it, helping my family for the same too.</p>Ali Murteza YesilFri, 10 Jul 2020 11:18:00 +0600tag:murtezayesil.me,2020-07-10:/privacy-for-the-whole-family.htmlTechprivacynextcloudself-hosting100DaysToOffload \ No newline at end of file +Ali Murteza Yesilhttps://murtezayesil.me/BlogTue, 11 Aug 2020 18:29:00 +0600Switching to Bluetooth earphoneshttps://murtezayesil.me/switching-to-bluetooth-earphones.html<p>After I droped my phone and broke its headphone jack, I had to switch to bluetooth earphone. Redmi Airdots is my choice thanks to its price.</p>Ali Murteza YesilTue, 11 Aug 2020 18:29:00 +0600tag:murtezayesil.me,2020-08-11:/switching-to-bluetooth-earphones.htmlPersonal100DaysToOffloadYet Another Last Hop Attempthttps://murtezayesil.me/yet-another-last-hop-attempt.html<p>Solus 4.1 was one of the best polished experiences I had. I hope it continues that way and I don't feel the need for a hop.</p>Ali Murteza YesilSun, 09 Aug 2020 22:00:00 +0600tag:murtezayesil.me,2020-08-09:/yet-another-last-hop-attempt.htmlPersonaldistros100DaysToOffloadMy Linux Journeyhttps://murtezayesil.me/my-linux-journey.html<p>Like many other distro hoppers, I tried many distros. Solus was one of the best polished experiences. That is not to say it is perfect.</p>Ali Murteza YesilFri, 07 Aug 2020 23:59:00 +0600tag:murtezayesil.me,2020-08-07:/my-linux-journey.htmlPersonaldistros100DaysToOffloadMarble League 2020https://murtezayesil.me/marble-league-2020.html<p>I am not like interested in sports. But I find Jelle's Marble Runs silly. That is a solid reason to love something 😅️</p>Ali Murteza YesilWed, 05 Aug 2020 11:11:00 +0600tag:murtezayesil.me,2020-08-05:/marble-league-2020.htmlPersonal100DaysToOffloadDigital Cleansing - Musichttps://murtezayesil.me/digital-cleansing-music.html<p>There aren't many options to buy DRM free music, are there!</p>Ali Murteza YesilMon, 03 Aug 2020 15:00:00 +0600tag:murtezayesil.me,2020-08-03:/digital-cleansing-music.htmlTechdigitalcleansingmusic100DaysToOffloadSwap on SSD done righthttps://murtezayesil.me/swap-on-ssd-done-right.html<p>SSDs are fragile and swaps can be damaging. But they can live happily together.</p>Ali Murteza YesilSat, 01 Aug 2020 12:00:00 +0600tag:murtezayesil.me,2020-08-01:/swap-on-ssd-done-right.htmlTech100DaysToOffloadSilent Rage Quitshttps://murtezayesil.me/silent-rage-quits.html<p>nobody saw it coming</p>Ali Murteza YesilThu, 30 Jul 2020 16:49:00 +0600tag:murtezayesil.me,2020-07-30:/silent-rage-quits.htmlPersonal100DaysToOffloadDecentralized Internet is More Reliablehttps://murtezayesil.me/decentralized-internet-is-more-reliable.html<p>Every system is prone to failure and will face down time. Decentralization avoids total system failure.</p>Ali Murteza YesilTue, 28 Jul 2020 12:00:00 +0600tag:murtezayesil.me,2020-07-28:/decentralized-internet-is-more-reliable.htmlTech100DaysToOffloadDeleting Amazon accounthttps://murtezayesil.me/deleting-amazon-account.html<p>Deleting Amazon account has more steps (friction) than I would like. But not impossible.</p>Ali Murteza YesilSun, 26 Jul 2020 21:15:00 +0600tag:murtezayesil.me,2020-07-26:/deleting-amazon-account.htmlNotes100DaysToOffloadDigital Cleansing - Mastodonhttps://murtezayesil.me/digital-cleansing-mastodon.html<p>Centralized microblogging platforms are rich in user data and attractive to cyber criminals. I recommend decentralized alternatives.</p>Ali Murteza YesilFri, 24 Jul 2020 15:23:00 +0600tag:murtezayesil.me,2020-07-24:/digital-cleansing-mastodon.htmlTechdigitalcleansingprivacyfediverse100DaysToOffload$ADB_VENDOR_KEYS is not sethttps://murtezayesil.me/adb_vendor_keys-is-not-set.html<p>Authorizing adb when no prompt will come, the hard way.</p>Ali Murteza YesilWed, 22 Jul 2020 00:00:00 +0600tag:murtezayesil.me,2020-07-22:/adb_vendor_keys-is-not-set.htmlNotesandroidproblem100DaysToOffloadFizzBuzz with single semicolonhttps://murtezayesil.me/fizzbuzz-with-single-semicolon.html<p>Attempt to write an eccentric FizzBuzz program with as few semicolon as possible.</p>Ali Murteza YesilMon, 20 Jul 2020 00:00:00 +0600tag:murtezayesil.me,2020-07-20:/fizzbuzz-with-single-semicolon.htmlNotescode100DaysToOffloadDigital Cleansing - Jitsihttps://murtezayesil.me/digital-cleansing-jitsi.html<p>My family and relatives live different countries and make good use of video calling services regardless of who is offering the service</p>Ali Murteza YesilSat, 18 Jul 2020 00:00:00 +0600tag:murtezayesil.me,2020-07-18:/digital-cleansing-jitsi.htmlTechdigitalcleansingprivacyjitsi100DaysToOffloadDigital Cleansing - NextCloudhttps://murtezayesil.me/digital-cleansing-nextcloud.html<p>NextCloud has 4 things going for me. It is FOSS, it gives me control, it is convenient and it works.</p>Ali Murteza YesilThu, 16 Jul 2020 10:00:00 +0600tag:murtezayesil.me,2020-07-16:/digital-cleansing-nextcloud.htmlTechdigitalcleansingprivacynextcloud100DaysToOffloadDigital Cleansing - Identifying services we usehttps://murtezayesil.me/digital-cleansing-identifying-services-we-use.html<p>Step 1 of digital cleansing is identifying services I want to drop</p>Ali Murteza YesilTue, 14 Jul 2020 03:40:00 +0600tag:murtezayesil.me,2020-07-14:/digital-cleansing-identifying-services-we-use.htmlTechdigitalcleansingprivacy100daystooffloadResizing 2500 photoshttps://murtezayesil.me/resizing-2500-photos.html<p>We needed to resize 2500 photographs for a website. There is a shell script for that.</p>Ali Murteza YesilMon, 13 Jul 2020 07:19:00 +0600tag:murtezayesil.me,2020-07-13:/resizing-2500-photos.htmlTechcode100DaysToOffloadDigital Cleansing For Better Privacyhttps://murtezayesil.me/digital-cleansing-for-better-privacy.html<p>I am documenting my journey to claiming my digital freedom. Previously called "My Master Plan For Privacy (of my family)".</p>Ali Murteza YesilSun, 12 Jul 2020 00:07:00 +0600tag:murtezayesil.me,2020-07-12:/digital-cleansing-for-better-privacy.htmlTechdigitalcleansingprivacy100DaysToOffloadPrivacy For The Whole Familyhttps://murtezayesil.me/privacy-for-the-whole-family.html<p>My story of learning about wounds in my privacy and my first steps to cure it, helping my family for the same too.</p>Ali Murteza YesilFri, 10 Jul 2020 11:18:00 +0600tag:murtezayesil.me,2020-07-10:/privacy-for-the-whole-family.htmlTechprivacynextcloudself-hosting100DaysToOffload \ No newline at end of file diff --git a/output/feeds/tech.atom.xml b/output/feeds/tech.atom.xml index 5e8066e..332e82e 100644 --- a/output/feeds/tech.atom.xml +++ b/output/feeds/tech.atom.xml @@ -329,7 +329,91 @@ This list may get longer as I remember services I subscribed to but didn't use i I will start with looking for alternatives to Google Drive.</p> <p>If there is any other service you think I should stay away from, you can write to comment toot.<br> If you have written a blog post as an answer, mention that too.<br> -If you think some of the services or softwares I mentioned here aren't that bad and I would be better of keep using them, please share why you think so. I want to keep an open mind and look at those services from your perspective too.</p>Digital Cleansing For Better Privacy2020-07-12T00:07:00+06:002020-07-12T00:07:00+06:00Ali Murteza Yesiltag:murtezayesil.me,2020-07-12:/digital-cleansing-for-better-privacy.html<p>I am documenting my journey to claiming my digital freedom. Previously called "My Master Plan For Privacy (of my family)".</p><p>I previously wrote about <a href="privacy_for_the_whole_family.md" title="Privacy For The Whole Family">how I got became more privacy caring individual</a> and I tooted about <a href="https://fosstodon.org/@murtezayesil/104480280886518081">My Master Plan for Privacy of My Family</a>. As I grew up, I came to realize how much we gave up on privacy for the convinience and "free" services. We are social creatures. I was using Google Photos, WhatsApp, Youtube and Instagram as much as I could and my family is doing the same. We are putting each other's privacy at stake by uploading data about each other without knowing. I decided to change that either by finding privacy focused alternatives to digital services I was using or by build server system to offer alternatives myself.</p> +If you think some of the services or softwares I mentioned here aren't that bad and I would be better of keep using them, please share why you think so. I want to keep an open mind and look at those services from your perspective too.</p>Resizing 2500 photos2020-07-13T07:19:00+06:002020-07-13T07:19:00+06:00Ali Murteza Yesiltag:murtezayesil.me,2020-07-13:/resizing-2500-photos.html<p>We needed to resize 2500 photographs for a website. There is a shell script for that.</p><p>I was asked to write a program to resize thousands of images which were gonna be uploaded to a website. Images had to be the same height for them to look organized in gallery. I remembered how I used <a href="https://imagemagick.org/">imagemagick</a> to write <a href="https://gitlab.com/murtezayesil/student/-/tree/master/sh/desktop-clock" title="use imagemagick, figlet and feh for tty-clock on wallpaper">desktop-clock</a>, immitate tty-clock on wallpaper. That experience helped me to design the program in my mind as we continue to speak on the phone.</p> +<div class="highlight"><pre><span></span><code>/‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾<span class="se">\ </span> +<span class="p">|</span> <span class="k">for</span> each image <span class="p">|</span> +<span class="p">|</span> <span class="k">do</span> resize to <span class="nv">height</span><span class="o">=</span><span class="m">800</span> <span class="p">|</span> +<span class="se">\_</span>__________________________/ + O + o <span class="se">\_\_</span> _/_/ + . <span class="se">\_</span>_/ + <span class="o">(</span>oo<span class="o">)</span><span class="se">\_</span>______ + <span class="o">(</span>__<span class="o">)</span><span class="se">\ </span> <span class="o">)</span><span class="se">\/\</span> + <span class="o">||</span>----w <span class="p">|</span> + <span class="o">||</span> <span class="o">||</span> +</code></pre></div> + + +<h1>This is a learning opportunity</h1> +<p>Since I don't have much of an experience on shell scripting, I was <a href="https://start.duckduckgo.com/" title="DuckDuckGo">Duck</a>ing everything. I learned to do few things during this task.</p> +<ol> +<li><a href="https://duckduckgo.com/?q=for+loop+shell+script" title="There are many tutorials">For loops in shell script</a></li> +<li>Getting <a href="https://stackoverflow.com/questions/2437452/how-to-get-the-list-of-files-in-a-directory-in-a-shell-script" title="I didn't know how to use asteriks 😅️">list of files</a></li> +<li>Correct syntax for <a href="https://imagemagick.org/script/convert.php" title="It ain't magick but it quiet is 😉️">resizing with ImageMagick</a></li> +</ol> +<p>After reading tutorials and looking at examples everything felt as simple as lego. I just needed to put them together. </p> +<p>Here is <code>image_shrinker.v0.1_alpha.sh</code> :</p> +<div class="highlight"><pre><span></span><code><span class="ch">#!/bin/sh</span> +mkdir ../output +<span class="k">for</span> image in ./* +<span class="k">do</span> + convert <span class="nv">$image</span> -scale 1000000x800 ../output/<span class="nv">$image</span> +<span class="k">done</span> +</code></pre></div> + + +<p>This version has problems which I can't call "feature" 😁️ :</p> +<ol> +<li>Resolution is hard coded. Btw, only way to define resolution is in WIDTHxHEIGHT format AFAIK.</li> +<li>Script must be in same directory as images</li> +<li>PWD must point to the directory where script is</li> +</ol> +<h2>Adjustable resolution</h2> +<div class="highlight"><pre><span></span><code><span class="ch">#!/bin/sh</span> +mkdir ../output +<span class="nv">WIDTH</span><span class="o">=</span><span class="nv">$1</span> <span class="p">;</span> <span class="nv">HEIGHT</span><span class="o">=</span><span class="nv">$2</span> + +<span class="k">for</span> image in ./* +<span class="k">do</span> + convert <span class="nv">$image</span> -scale <span class="nv">$WIDTHx$HEIGHT</span> ../output/<span class="nv">$image</span> +<span class="k">done</span> +</code></pre></div> + + +<p>This fixes the hard coded resolution problem but new problem is that the user has to know that WIDTH and HEIGHT must be given. I fix that by showing correct syntax to the user and then exiting :</p> +<div class="highlight"><pre><span></span><code><span class="ch">#!/bin/sh</span> + +<span class="k">if</span> <span class="o">[</span> <span class="nv">$#</span> -lt <span class="m">2</span> <span class="o">]</span> +<span class="k">then</span> + <span class="nb">echo</span> <span class="s2">&quot;USAGE:&quot;</span> + <span class="nb">echo</span> -e <span class="s2">&quot;\t\$IMAGE_DIRECTORY/image_shrinker.sh WIDTH HEIGHT&quot;</span> + <span class="nb">exit</span> <span class="m">1</span> +<span class="k">fi</span> + +<span class="nv">WIDTH</span><span class="o">=</span><span class="nv">$1</span> <span class="p">;</span> <span class="nv">HEIGHT</span><span class="o">=</span><span class="nv">$2</span> +mkdir ../output + +<span class="k">for</span> image in * +<span class="k">do</span> + convert <span class="nv">$image</span> -scale <span class="nv">$Resolution</span> ../output/<span class="nv">$image</span> +<span class="k">done</span> +</code></pre></div> + + +<p>Here is some other attempt to make code a bit more flexible in terms of where images can be and where output can go. Actually no but that is what I was going for 😜️</p> +<div class="highlight"><pre><span></span><code><span class="ch">#!/bin/sh</span> + +<span class="nv">DIR</span><span class="o">=</span><span class="sb">`</span><span class="nb">pwd</span><span class="sb">`</span> + +<span class="k">for</span> image in ./*.* +<span class="k">do</span> +<span class="c1"># Below code will scale images to 800px height without breaking aspect ratio</span> + convert <span class="nv">$DIR</span>/<span class="nv">$image</span> -scale 10000x800 -write <span class="nv">$DIR</span>/../output/<span class="nv">$image</span> +<span class="k">done</span> +</code></pre></div> + + +<p>It is hard to ask for help (especially after torturing with my code) but if you would like to give me feedback and advice, reply to toot of this post.</p>Digital Cleansing For Better Privacy2020-07-12T00:07:00+06:002020-07-12T00:07:00+06:00Ali Murteza Yesiltag:murtezayesil.me,2020-07-12:/digital-cleansing-for-better-privacy.html<p>I am documenting my journey to claiming my digital freedom. Previously called "My Master Plan For Privacy (of my family)".</p><p>I previously wrote about <a href="privacy_for_the_whole_family.md" title="Privacy For The Whole Family">how I got became more privacy caring individual</a> and I tooted about <a href="https://fosstodon.org/@murtezayesil/104480280886518081">My Master Plan for Privacy of My Family</a>. As I grew up, I came to realize how much we gave up on privacy for the convinience and "free" services. We are social creatures. I was using Google Photos, WhatsApp, Youtube and Instagram as much as I could and my family is doing the same. We are putting each other's privacy at stake by uploading data about each other without knowing. I decided to change that either by finding privacy focused alternatives to digital services I was using or by build server system to offer alternatives myself.</p> <p>I am not the first to do this. There are many privacy friendly alternatives developed by people who care about privacy. It isn't hard to find those <a href="https://alternativeto.net/" title="Crowdsourced Software Recomendations">alternatives</a>. Many people went through this journey, which I call "Digital Cleansing For Better Privacy". During my journey, I will document the steps I have taken and write my thoughts about the alternatives I tried.</p> <hr> <h1>Digital Cleansing For Better Privacy</h1> diff --git a/output/index2.html b/output/index2.html index 3082080..1bd5daa 100644 --- a/output/index2.html +++ b/output/index2.html @@ -127,6 +127,22 @@ | tags: digitalcleansingprivacy100daystooffload | Day 3 of #100DaysToOffload + + + +
  • diff --git a/output/resizing-2500-photos.html b/output/resizing-2500-photos.html new file mode 100644 index 0000000..8877097 --- /dev/null +++ b/output/resizing-2500-photos.html @@ -0,0 +1,214 @@ + + + + + Resizing 2500 photos + + + + + + + + + + + + + + + +
    +
    +
    +

    + Resizing 2500 photos

    +
    + +
    +

    I was asked to write a program to resize thousands of images which were gonna be uploaded to a website. Images had to be the same height for them to look organized in gallery. I remembered how I used imagemagick to write desktop-clock, immitate tty-clock on wallpaper. That experience helped me to design the program in my mind as we continue to speak on the phone.

    +
    /‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾\ 
    +| for each image            |
    +|   do resize to height=800 |
    +\___________________________/ 
    +  O
    +    o  \_\_    _/_/
    +      .    \__/
    +           (oo)\_______
    +           (__)\       )\/\
    +               ||----w |
    +               ||     ||
    +
    + + +

    This is a learning opportunity

    +

    Since I don't have much of an experience on shell scripting, I was Ducking everything. I learned to do few things during this task.

    +
      +
    1. For loops in shell script
    2. +
    3. Getting list of files
    4. +
    5. Correct syntax for resizing with ImageMagick
    6. +
    +

    After reading tutorials and looking at examples everything felt as simple as lego. I just needed to put them together.

    +

    Here is image_shrinker.v0.1_alpha.sh :

    +
    #!/bin/sh
    +mkdir ../output
    +for image in ./*
    +do
    +    convert $image -scale 1000000x800 ../output/$image
    +done
    +
    + + +

    This version has problems which I can't call "feature" 😁️ :

    +
      +
    1. Resolution is hard coded. Btw, only way to define resolution is in WIDTHxHEIGHT format AFAIK.
    2. +
    3. Script must be in same directory as images
    4. +
    5. PWD must point to the directory where script is
    6. +
    +

    Adjustable resolution

    +
    #!/bin/sh
    +mkdir ../output
    +WIDTH=$1 ; HEIGHT=$2
    +
    +for image in ./*
    +do
    +    convert $image -scale $WIDTHx$HEIGHT ../output/$image
    +done
    +
    + + +

    This fixes the hard coded resolution problem but new problem is that the user has to know that WIDTH and HEIGHT must be given. I fix that by showing correct syntax to the user and then exiting :

    +
    #!/bin/sh
    +
    +if [ $# -lt 2 ]
    +then
    +    echo "USAGE:"
    +    echo -e "\t\$IMAGE_DIRECTORY/image_shrinker.sh WIDTH HEIGHT"
    +    exit 1
    +fi
    +
    +WIDTH=$1 ; HEIGHT=$2
    +mkdir ../output
    +
    +for image in *
    +do
    +    convert $image -scale $Resolution ../output/$image
    +done
    +
    + + +

    Here is some other attempt to make code a bit more flexible in terms of where images can be and where output can go. Actually no but that is what I was going for 😜️

    +
    #!/bin/sh
    +
    +DIR=`pwd`
    +
    +for image in ./*.*
    +do
    +#   Below code will scale images to 800px height without breaking aspect ratio
    +    convert $DIR/$image -scale 10000x800 -write $DIR/../output/$image
    +done
    +
    + + +

    It is hard to ask for help (especially after torturing with my code) but if you would like to give me feedback and advice, reply to toot of this post.

    +
    + + +

    Day 18 of #100DaysToOffload

    + + + +
    +
    +
    +
    +

    blogroll

    + +
    + +
    + + + + + + + + + + + \ No newline at end of file diff --git a/output/tag/100daystooffload2.html b/output/tag/100daystooffload2.html index 444cc36..6dd56a5 100644 --- a/output/tag/100daystooffload2.html +++ b/output/tag/100daystooffload2.html @@ -127,6 +127,22 @@ | tags: digitalcleansingprivacy100daystooffload | Day 3 of #100DaysToOffload + + + +
  • diff --git a/output/tag/code.html b/output/tag/code.html index 991e9d4..3b26857 100644 --- a/output/tag/code.html +++ b/output/tag/code.html @@ -89,11 +89,30 @@

    Comments

    Toot on this thread to comment. This blog is a static site. Comments won't appear here.

    + +
    +

    Other articles

    +
      + +
    1. +

    Page 1 / 1

    - -
    diff --git a/output/tags.html b/output/tags.html index 1ae0358..9a9231c 100644 --- a/output/tags.html +++ b/output/tags.html @@ -49,9 +49,9 @@
    -

    Tags for Ali Murteza Yesil

  • 100DaysToOffload (17)
  • +

    Tags for Ali Murteza Yesil

  • 100DaysToOffload (18)
  • android (1)
  • -
  • code (1)
  • +
  • code (2)
  • digitalcleansing (6)
  • distros (2)
  • fediverse (1)