Saturday, 3 October 2020

Magic of Browser Bookmarks - Automate Simple Tasks using JavaScript

 As I promised in #LearnedToday, I'm going to show you how much you can achieve with this little bookmark feature in the browsers.

Ever wondered how to easily remove citations from a Wikipedia page? 

What are bookmarks?

The bookmarks in the browsers are to save the links to the pages you wish visiting again, or you just find them useful and save for later. 

Instead of creating a text file "Imp Links"and saving all the links there (I've done it a lot), you could use browser's bookmark feature.

The shortcut to bookmark a webpage in most of the broswsers is ctrl+b.

What more can they do?

To sum up, they can run JavaScript on a page. So instead of opening broswer console to do run a couple lines of code, you could create a bookmark and click that instead.

Example?

Whenever I needed to copy something from Wikipedia, I usually had to deal with the references/citations they have. You must've seen those, with squared brackets around numbers, something like this [1] or with a disclaimer like [citation needed] etc. I needed to remove all those. 

Initially, I used to do it in MS Word manually, by Find and Replace. I don't remember that now, doesn't matter anyway. 

Finally, I came to know about this browser bookmarklets, and then a simple regex was enough to do the work for me.

Now I have a simple bookmark. I go to any Wikipedia page, select the text I need, and click the bookmark. Viola! Citations are removed.

How to create a bookmarklet?

Got to Bookmarks Manager

1. Click three vertical dots in the upper right corner > Bookmark > Bookmark Manager

Or chrome shortcut: ctrl+shift+o

Or type in the address bar: chrome://bookmarks/

2. Click three vertical dots in the upper right corner of Bookmark manager (Shows tooltip: Organize) 

3. Add new bookmark

4. It will show a popup with two fields: Name and URL. 

5. Give any appropriate name, and in the URL bar, paste the JavaScript code you want to execute.

6. Click Save. 


You have your bookmarklet ready. 

Show/Hide Bookmarks bar with ctrl+shift+b. Clicking on the name of your bookmark will run the underlying code. 

Which bookmarklets am I using?

1. Citation Remover discussed above. 

2. A tiny calculator which returns results of simple arithmetic operations.

3. StyleStripper which strips all CSS styles from a webpage. Helpful if I don't want to load an entire page I want to copy something from.Also works on the sites which disable copying using JavaScript. Click StyleStripper and you can copy the text.


To those who requested, don't complain now. I have shared it finally. More such tips will follow. Keep visiting! Or not. But I know you will. :wink:

Rab Raakha!

Friday, 2 October 2020

PDF to Single Image - A Tutorial by 17 Year Old Me

Back in the days when I had a small Nokia phone, I wanted to do EVERTHING in that tiny device. It wasn't actually mine but because I was going to college, I was more "in need" of it than my sister.

Nokia-C1-01 Phone I had in my Engineering
Source: gsmarena.com [1]

The one on your right with maroon border. That was it.

Anyway, with a screen of 144x160px, I wanted to read PDFs which were stored in our desktop + laptop. Lots of books, of almost all genres I was interested in. Interestingly enough, the same neatly arranged folders are copied over to every computer I have used. So I still have all those books, plus what was added later on.

Initially, the idea to "read PDF on phone" was for the Quran, so that I could read it in the Indo-Pak Naskh font. Actually I had a Quran app in it, full text with super fast search engine, but the font used in that wasn't good enough for long tilaawat. In fact, even after getting android phone I've been searching something as fast as that.I had been a fan of that guy who built it. Just looked it up, he goes by the name of Raza Mahi. His "Mahi Dictionary" was awesome too. All java .jar applications are things of the past now, but he has also moved on and started to build the similar apps for Android now. Good for him. Linking the website in the references. [2]

So where was I? Yes. As I had difficulty reading the Quran in that app, I selected a PDF copy of Quran which had Arabic text in one column and its Urdu translation side-by-side. I cropped-out the translation part (making the text narrow enough to fit on my phone) and then started thinking about a way to achieve the result.

Necessity is the mother of invention, so I came up with these two methods discussed in the booklet below. Will attach the Quran files too for the record. Wow! Time flies. Seems like yesterday to me.

Later on when I converted many books using the same method, I compiled this short tutorial in the form of booklet. I've left the whole text as is, without any correction in grammar or sentence structure, because

  1. It's a reminder of my journey (read and see how writing styles change)
  2. It's cute. ;)
Here's the summary of the two methods discussed in the booklet:

Method 1: Microsoft Office OneNote + MS Paint
Method 2: PDF to Images + IrfanView

Read the booklet and know how to use them. And remember it's an OLD tutorial.

DOWNLOADS

PDF to Single Image Tutorial (Booklet) : Read online or download

https://archive.org/details/PDFToSingleImageShakes.Ahmad

IrfanView: I came to know later on that this was very popular image-manipulation tool back then, and still is. Its first release was in June 1996. Now it's more powerful than ever. Check its Wikipedia page.[3]

https://www.irfanview.com

PDF to Images Converter: I still use it. Small size, works smoothly.

https://www.weenysoft.com/free-pdf-to-image-converter.html


Enjoy!


Reference

[1] Specifications of Nokia C1-01 via gsmarena [link]

[2] Raza Mahi Team - Old Apps [link]

[3] IrfanView on Wikipedia [link]

Wednesday, 1 July 2020

Beginning second half of 2020 — Resolutions?

Yep! That's it. It doesn't stop. 

And sadly enough, the past 4 months we all have been locked up in the lock-down. People like me are in luck, because we don't go out much anyway. Now that we have loads of free time, a lot of my friends planned interesting activities they've been dying to involve in for ages. And guess what? They are actually doing them. I know right?



Anyway! The things I'd planned have really been a mess in my head as always, but writing the resolution actually made me do some work this time. So folks, writing down ideas help. 

Resolutions

Time to see what I did from things I planned in the beginning of this year. 

Maintaining my personal log/diary/rant etc. 

Nope. Never doing that. Because it needs time and I'm busy stuffing my head with new "knowledge" all the time. 😏 It's not a priority anyway. I don't know why I chose this in the first place. 😤

LearnedToday

I started writing this with a hashtag on facebook, and till date I've written 29 of them. In six months, minus 15 days of Umra, It should've been at least a hundred, but anyway. After a long time I did something consistently. And I'm proud of it. 


Weekly – Start posting the stuff I learn every week

Actually a good idea. Did I do something? Nope. Will do? iA. 😁

Sharing – Personal experience + Psychology + Self-help + Philosophy etc.

OK no joking from here. This is actually not on the priority, when I'll be done with the REAL work, I'd start spreading my gyaan. I hope I start it this very year though. 

Works – previous & current (writing+projects)

Red alert. This ranks highest on my priority list. And I'm pretty positive about this with myself. Alhamdulillah! You'll see in the upcoming days.

Tutorials for absolute beginners

Yep, but not unless I find something which has not been done before in the way I'm planning. Have worked on some tutorials actually.

Reading

Finished more than five books of different lenghts. I'm also planning to start writing reviews of them both in English and Urdu. Not quite sure how writing English reviews for Urdu stuff would go. 

Reviewing English stuff in Urdu would be fun. So that ain't going anywhere.

___

That was a little overview. 

Lastly, an exciting news! Urdu Mehfil has completed its 15 years. May Allah keep it alive and make it more beneficial for the Urdu community. 

The birthday celebrations of Urdu Mehfil always push us to contribute. Good for me. 

Rab raakha!👋

Monday, 15 June 2020

Ham Pe Saaqi Ki Inaayat - Ghazal

To read in Urdu (Perso-Arabic script), click here.

English (Roman)


Ham pe saaqee ki inaayat se jale jaate hain
Ye jo ab tak kaf-e-afsos male jaate hain

Yaad aa jaatee hain besaakhta baaten unki
Besabab hont tabassum mein dhale jaate hain

Vaqt-e-rukhsat ki pas-o-pesh unhen kya maaloom
Dil ruka jaata hai jaane se vale jaate hain

Rafta-rafta dam-e-aakheer bhi aa pahunchega
Raat-din vasl ke vaadon pe tale jaate hain

Jaaiye kuchh nahin kehte, jo hua hai so hua
Saare ilzaam muqaddar ke gale jaate hain

Zabt-e-girya men Shakeeb aapne paaya hai kamaal
Unki galiyon se bhi chup-chaap chale jaate hain


Hindi (Devanagari)


हम पे साक़ी की इनायत से जले जाते हैं
ये जो अब तक कफ-ए-अफ़सोस मले जाते हैं

याद आ जाती हैं बेसाख़ता बातें उनकी
बेसबब होंट तबस्सुम में ढले जाते हैं

वक़्त-ए-रुख़सत की पस-ओ-पेश उन्हें क्या मालूम
दिल रुका जाता है जाने से वले जाते हैं

रफ़्ता-रफ़्ता दम-ए-आख़ीर भी आ पहुँचेगा
रात-दिन वस्ल के वादों पे टले जाते हैं

जाईए कुछ नहीं कहते, जो हुआ है सो हुआ
सारे इल्ज़ाम मुक़द्दर के गले जाते हैं

ज़ब्त-ए-गिर्या में शकीब आपने पाया है कमाल
उनकी गलीयों से भी चुप-चाप चले जाते हैं

Meanings

Saaqi (साक़ी): one who serves wine, a sweetheart, शराब पिलाने वाला , यानी मेहबूब 

Inaayat (इनायत): blessings, करम, नवाज़ना 

Kaf-e-afsos malna (कफ-ए-अफ़सोस मलना): hand wrung in distress, अफ़सोस करते हुए हथेलियों को मलना 

Be-saakhta (बे-साख़्ता): spontaneously, extempore, अचानक, सहसा

Be-sabab (बेसबब): without any reason, बे वजह 

Tabassum (तबस्सुम):  smile, मुस्कुराहट

Pas-o-pesh (पस-ओ-पेश): hesitation, indecision, आगे पीछे होना, झिजक, हिचकिचाहट 

Vale (वले): yet, however, लेकिन 

Vasl (वस्ल): union, meeting,मिलन

Zabt-e-Girya (ज़ब्त-ए-गिर्या): holding back tears, रोने पर क़ाबू पाना, आँसू ना निकलने देना 


Sunday, 14 June 2020

[Hindi] Ham aur Ehsaas-e-bechaargi (on suicide of Sushan Singh Rajput)

हम और एहसास-ए-बेचारगी

(सुशानत सिंह राजपूत (अदाकार) की 34 साल की उम्र में ख़ुदकुशी पर)

Note: Consider this a rant or monologue by someone who's frustrated. 

मुझे हैरत इस बात पर है कि क्या हम वाक़ई इतने कमज़ोर हैं कि ज़िंदगी की कशाकश से यूं हार मान जाएं? हम इतने ही बेवक़ूफ़ हैं कि अपने अतराफ़ के लोगों को , उनकी बातों को आसाब पर इस क़दर सवार कर लें कि अपना जीना हराम हो जाये?

ऐवें ही इधर उधर की गप्पें और बकवासों में वक़्त ज़ाए कर लें, लोगों की बातें सन सुनकर अपना दिमाग़ ख़राब कर लें और फिर डिप्रेशन की गोलीयां खाईं। वाह बड़े अक़लमंद हैं आप। 

अजी छुट्टी करें। लानत भेजें उन लोगों पर जो आपको कचरे की तरह इस्तिमाल करते हैं। और नज़रअंदाज कीजीए उनको जो आपके लिए बेहूदा आरा रखते हैं। क्या मुसीबत है आपकी ज़िंदगी में? आप फुट -पाथ पर सोते हैं? भुकमरी से जूझ रहे हैं? फ़ाक़े कर रहे हैं? किसी की मोहताजी है?
फिर किया?
किसी ने गाली दी? तंज़ किया? ग़ीबत की? चुगु़ली की? मुँह पर बेइज़्ज़ती की? किसी आदत का मज़ाक़ उड़ाया?

बस एक-बार देख लें, क्या आप में वो ख़साइल मौजूद हैं? और वाक़ई ऐसी चीज़ें हैं जिन्हें बुरा शुमार किया जाना चाहिए? हैं तो शुक्रिया के साथ क़बूल करें। उनका लहजा कितना ही बुरा सही, उन्होंने आपका फ़ायदा ही किया है। फ़ायदा उठाइए।

और अगर आप में वो आदतें वो ख़साइल मौजूद नहीं तो आपकी सेहत पर किया फ़र्क़ पड़ा? कुछ भी नहीं।

जनाब-ए-मन!
भाड़ समझते हैं? जी हाँ। सबको वहीं झोंकिए और अपनी ज़िंदगी जीनी शुरू कीजीए। अपने लोग और अपनी ख़ुशी वाली ज़िंदगी। क्योंकि जो लोग आपको उजाड़ने में शरीक होंगे वो आपके मरने के बाद आप पर नौहा नहीं करेंगे, बल्कि किसी दूसरे को उजाड़ने में मसरूफ़ होंगे।

ख़ुदारा इन बेवक़ूफ़ों को तवज्जा देकर अपना वक़्त बर्बाद मत कीजीए।मुस्कुरा कर टालीए और हाथ झाड़कर आगे चल पड़िए।

आपके लिए तो दुनिया में बहुत काम हैं, आपने तो अभी नई नई पेंटिंग सीखनी शुरू की है, ख़त्ताती पर हाथ आज़माने हैं, गाने का शौक़ पूरा करना है, तैराकी सीखनी है, वो कराटे की क्लास कब से ज्वाइन करने का सोच रखा है, कुछ अमल भी करेंगे या बस अरतग़रल देख देखकर ख़ुद में जोश ही भरते रहेंगे? वो तीन अधूरे नावल और सीरत उन्नबी वाली किताब पढ़नी शुरू की थी, वो कब ख़त्म होगी

प्रोग्रामिंग सीखने का सोचा था उस का क्या बना? यू-टयूब चैनल बनाने का शौक़ था वो बन चुका? फ़ुलां अंग्रेज़ी किताब का तर्जुमा करने का सोचा था, कर चुके? कुरानी अरबी सीखने का इरादा था, आज ही से ना शुरू कर दें? हिफ़्ज़ कर के अपने वालदैन की आँखें ठंडी करनी थीं, एक-बार भी कोशिश नहीं की? किसी ग़ैर मुस्लिम दोस्त ने इस्लाम के मुताल्लिक़ पूछा था, लेकिन आपने दावत देनी तो कभी सीखी ही नहीं। याद है कितना शर्मिंदा हुए थे। क्यों ना ये भी सीख लिया जाये? पता नहीं कौन कब ऐसे ही अचानक ज़िंदगी से किनारा कर ले और हम अमानत ना पहुंचा सकें? तफ़सीर का प्रोग्राम देखकर पहली बार अल्लाह के कलाम को समझने की कोशिश की थी, पूरी कर लो तो कोई गर्दन से दबोच लेगा कि क्यों मुकम्मल कर ली? दिन-भर वाट्स एप्प फेसबुक पर-अलम ग़लिम पढ़ते हैं, फ़ज्र बाद पाओ पारा क़ुरआन ही पढ़ लें तो क्या बुरा हो। 

सुबह जॉगिंग पर जाना शुरू किया था तो ख़त्म क्यों हो गया? और वो वरज़िश क्यों छोड़ दी? लोग देखते थे तो शरम आती थी, लेकिन अब लोगों की पर्वा करना तो आप छोड़ चुके, तो शुरू करें? ज़माना हो गया , दोस्तों के साथ आख़िरी दफ़ा फूटबाल खेले हुए। चलें कोई तर्तीब बनाई जाये। अरसा गुज़रा कि आपने वो पसंदीदा आइसक्रीम नहीं खाई। ले आएं दो एक स्पून। ज़रा देखना तो वो चाट सैंटर खुल रहा है या नहीं, भाग कर दो कचौरियां बंधवा लाएंगे। बल्कि घर भर के लिए लेते लाएंगे, सिर्फ आप ही थोड़े ही चटोरे हैं। 

अपने आस-पास देख लें। अपनी फ़ैमिली में, आपके हल्क़ा-ए-अहबाब में। कोई बेसकून है तो इस को सुकून दीजीए। कोई गम-ज़दा है तो उसे हंसाईए। लोगों को मुस्कुराहट दीजीए। सवाब की नीयत ही कर लें, दूसरों को ख़ुशी बाँटना सवाब का काम है। यक़ीन नहीं आता तो मुहल्ले के मुफ़्ती साहिब से पूछ लें। 

अच्छा इस सब का फ़ायदा? सादा सा उसूल है बेचारे तब्लीग़ियों का, आप जिस चीज़ की दावत देंगे वो आपके अंदर पैदा होगी। आप भी सुकून में रहेंगे। आप भी ग़म को मुस्कुरा कर झेलने का हुनर सीख जाऐंगे। और आप भी दुनिया को शाकी नज़रों से देखने की बजाय तशक्कुर के साथ देखने लगेंगे। 

और हाँ रोने का मन कर रहा है तो रो लीजीए। इस में क्या दिक़्क़त है। रोना तो अज़हद ज़रूरी है, आप कोई रोबोट तो हैं नहीं। लेकिन ये भी समझिए कि ज़िंदगी वहीं नहीं रुक जाती। वक़्त चलता रहता है, उसे आप रोकने की कोशिश करेंगे तो रुल जाऐंगे। इस के साथ चलीए। 
माज़ी को अच्छी और बुरी यादों से नहीं, सिर्फ नास्टलजया से ताबीर कीजीए। 
हाल को जिएँ, कि यही सब कुछ है जो आपके पास है। 
और मुस्तक़बिल का सामान तैयार रखीए, पता नहीं कब बोरिया बिस्तर बांध कर जाना पड़ जाये। 

शकीब अहमद
14 जून2020، 7:30 बजे शाम

Friday, 24 April 2020

Cicada 3301 - A Mystery in the Cyber World

How I came across this?

So the year was 2017 I suppose, I was newly introduced to the dark web, and started watching creepy-pastas spread over the internet. It was interesting. Fascinating yet controversial. 

That's what makes it go viral, doesn't it? We all love conspiracies.

Considering my history of watching those videos, the YouTube suggestion algorithm one day decided to show me a video by LEMMiNO titled "Cicada 3301: An Internet Mystery" [link below]. And that short video introduced almost all concepts I'd studied in Cyber Security.

Let me appreciate that guys editing skills first of all.What a lovely piece of craft, indeed! 

When I watched the video, the curiosity made me search for more details related to it. I visited the Reddit threads related to it myself and the related onion links too. (Taken down, of course.)

Here's a small introduction of what this mystery was, thanks to Wiki, Reddit and several other resources. 

What’s Cicada 3301?

The most elaborate and mysterious puzzle of the internet age. — The Washington Post
Cicada 3301 is a nickname given to an organization that on three occasions has posted a group of puzzles to recruit code-breakers from the internet.

Different Rounds

The puzzle had few rounds. Nobody from the public knew that the next round exists, let alone guess it's date or format. It was because there was no official (signed message) from Cicada.

  1. The first internet puzzle started on January 4, 2012 on 4chan and ran for about one month.
  2. A second round began one year afterward January 4, 2013.
  3. And then a third round following the confirmation of a fresh clue posted on Twitter on January 4, 2014.

The stated intent was to recruit “intelligent individuals” by presenting a series of puzzles which were to be solved.

No new puzzles were published on January 4, 2015. However, a new clue was posted on Twitter on January 5, 2016. In April 2017 a verified PGP-signed message was found:
Beware false paths. Always verify PGP signature from 7A35090F.
That message explicitly denies the validity of any unsigned puzzle, as recently as April 2017.
The puzzles focused heavily on:

  • data security
  • cryptography
  • steganography
  • internet anonymity
  • surveillance

Speculations

It has been called “the most elaborate and mysterious puzzle of the web age” and is listed as one of the “top 5 eeriest, unsolved mysteries of the internet”, and much speculation exists on its function.
Many have speculated that the puzzles are a recruitment tool for the NSA, CIA, MI6, a “Masonic conspiracy” or a cyber mercenary group. Others have claimed Cicada 3301 is an alternate reality game.

No company or individual has taken credit for it or attempted to monetize it, however.

The Cicada 3301 Puzzle

Before diving into the main points, let me clear what it’s on the very surface level. It’s a puzzle which is posted on the web with the intentions of recruiting “highly intelligent individuals”.

Solving which supposedly gets you recruited to the NSA, MI6, Hacker groups and therefore the speculations go on and on; although no official prize has ever been announced.

It all started on January 4th, 2012. An elaborate puzzle appeared on message boards and forums which read:

This image when opened using a text editor gives out a Caesar cipher string of semi-readable text, which when deciphered results in an Image URI.

The chase then continued, one clue leading to another. The puzzles used all sorts of techniques in cyber-security including cryptography, steganography etc. They even dropped some clues on physical addresses.

Finally the website closed with a line saying
“We want the best, not the followers”. 
Soon there was a month of silence and then this Image was posted on the sub-reddit on Cicada.


According the Cicada they have found the people they were looking for. But the community out there was not satisfied because of the lack of ending to what was this all about. And many termed it as a wild goose chase and waste of time

But little did we know, this was just the beginning. After an year another quiz dropped on the forum.

The second and third round went similarly. A detailed analysis can be watched in this video.
. . .
by
Shakeeb Ahmad
Abuzar Gaffari
Ashwini Ghonse
Mustafa Al-Hammadi

[This is a truncated version of a 10-page long blog submitted to the institution.]

Friday, 17 April 2020

Shakeeb Naam Ka Ik Bad-Tameez Hai Koi - Ghazal

To read in Urdu (Perso-Arabic script), click here.

English (Roman)

Hareem-e-naaz men har-dil-azeez hai koi
Ziyaad-e-rashk se phir ashk-reez hai koi

Abas hi rote hain ahbaab mere marne par
Visaal-e-yaar bhi rone ki cheez hai koi

Libaas-e-faakhera pehne ye khush-numa dunya
Baraa-e-ahl-e-tasawwuf kaneez hai koi

Tere jamaal ki taabaaniyon se raushan ho
Hamaare dil pe jo parda dabeez hai koi

Diwana waar pukaare hai jo tujhe shab-o-roz
Shakeeb naam ka ik bad-tameez hai koi



Hindi (Devanagari)

हरीम-ए-नाज़ में हर-दिल-अज़ीज़ है कोई
ज़ियाद-ए-रशक से फिर अश्क-रीज़ है कोई

अबस ही रोते हैं अहबाब मेरे मरने पर
विसाल-ए-यार भी रोने की चीज़ है कोई

लिबास-ए-फ़ाखिरा पहने ये ख़ुशनुमा दुनिया
बराए अहल-ए-तसव्वुफ़ कनीज़ है कोई

तिरे जमाल की ताबानियों से रोशन हो
हमारे दिल पे जो पर्दा दबीज़ है कोई

दिवाना वार पुकारे है जो तुझे शब-ओ-रोज़
शकीब नाम का इक बदतमीज़ है कोई

Meanings

Hareem-e-naaz (हरीम-ए-नाज़): abode of beloved, महबूब का घर
Har-dil-azeez (हर-दिल-अज़ीज़): popular, liked by all, मशहूर, सब में पसंद किया जाने वाला
Ziyaad-e-rashk (ज़ियाद-ए-रशक): excess of envy, ईष्रया का ज़्यादा होना
Ashk-reez (अश्क-रीज़): weeping, shedding tears, अश्रु वर्षा, आँसू बहाना
Abas (अबस): futile, profitless, purposeless, व्यर्थ, निरर्थक, बेकार, बेफ़ायदा, बेकार
Visaal-e-yaar (विसाल-ए-यार): meeting with friend, meeting with beloved, महबूब से मुलाक़ात
Libaas-e-faakhera (लिबास-ए-फ़ाख़िरा): precious garments, worth being proud of, क़ीमती कपडा
Dabeez (दबीज़): thick, strong, मोटा, गफ़
Shab-o-roz (शब-ओ-रोज़): night and day, always, all the time, सुबह शाम, हमेशा