I spent a week offline here is how I stayed productive
Bhupesh Varshney ๐พ
Posted on April 1, 2020
Hi there, its been a long time since I have written something here.
I hope all of you are in good health ๐ช.
This post was originally written here
Backstory
My Internet was affected recently due to some unforseen reasons, this means that I was completely offline (i.e no texting, no memes & no git push
๐ญ).
I was afraid this will hinder my work & stop my learning but as it turns out, my past decisions somehow saved me.
I actually have this habit of downloading & saving useful PDFs (Books to be specific) & never read them again ๐, so I had started organising them under proper categories.
I started looking for these "PDFs" on my PC & after 15 mins of searching here is how the goldmine of info. looks like
PDF-Learning
โโโ Algorithms & Data Structures
โย ย โโโ Algorithms for dummies.pdf
โย ย โโโ AlgorithmsNotesForProfessionals.pdf
โย ย โโโ CLRS.pdf
โย ย โโโ Competitive Programming.pdf
โโโ C++
โย ย โโโ Accelerated C++.pdf
โย ย โโโ A Tour of C++ - Bjarne Stroustrup (Addison-Wesley, 2018).pdf
โย ย โโโ C-- 11.pdf
โย ย โโโ C++14 syntax reference.pdf
โย ย โโโ C++ Game Development Book.pdf
โย ย โโโ C++ GUI Programming with QT4, Second Edition.pdf
โย ย โโโ C++ Interview Questions.pdf
โย ย โโโ C++ NotesForProfessionals.pdf
โย ย โโโ cpp-best-practices.pdf
โย ย โโโ cpplambda_preview_25th_march_2019.pdf
โย ย โโโ C++ standard library reference.pdf
โย ย โโโ C++ STL_ReferenceManual.pdf
โย ย โโโ History_of_C++.pdf
โโโ Computer Vision
โย ย โโโ OpenCV_Computer_Vision_with_Python_-eBook-.pdf
โย ย โโโ opencv-python-tutroals.pdf
โโโ dotNET
โย ย โโโ complete-reference-vb_net.pdf
โย ย โโโ DotNETFrameworkNotesForProfessionals.pdf
โย ย โโโ Intro to VB.NET.pdf
โย ย โโโ vb.net_tutorial.pdf
โย ย โโโ VisualBasic_NETNotesForProfessionals.pdf
โโโ GNU Octave
โย ย โโโ Jesper Schmidt Hansen - GNU Octave for Beginners.pdf
โย ย โโโ octave.pdf
โย ย โโโ octave_tutorial_coursera.pdf
โย ย โโโ rob2-03-octave.pdf
โโโ HTML5 & CSS
โย ย โโโ book.pdf
โย ย โโโ Bootstrap
โย ย โย ย โโโ Bootstrap-Programming-Cookbook.pdf
โย ย โย ย โโโ bootstrap_tutorial.pdf
โย ย โโโ CSS 3.pdf
โย ย โโโ cssanimation-101.pdf
โย ย โโโ CSSNotesForProfessionals.pdf
โย ย โโโ css_tutorial.pdf
โย ย โโโ cssvisualdictionary2ND.pdf
โย ย โโโ cssvisualdictionary.pdf
โย ย โโโ HTML5NotesForProfessionals.pdf
โย ย โโโ html5_tutorial.pdf
โย ย โโโ wsu-css-cheat-sheet.pdf
โโโ JS
โย ย โโโ AJAX
โย ย โย ย โโโ Ajax.pdf
โย ย โย ย โโโ ajax_tutorial.pdf
โย ย โโโ Angular JS
โย ย โย ย โโโ AngularJSNotesForProfessionals.pdf
โย ย โย ย โโโ angularjs_tutorial.pdf
โย ย โโโ javascriptgrammar-dark.pdf
โย ย โโโ javascriptgrammar-II.pdf
โย ย โโโ javascript-handbook.pdf
โย ย โโโ Javascript JSON and Ajax v2.pdf
โย ย โโโ JavaScriptNotesForProfessionals.pdf
โย ย โโโ Javascript.pdf
โย ย โโโ javascript_tutorial.pdf
โย ย โโโ jQuery
โย ย โย ย โโโ jQueryNotesForProfessionals.pdf
โย ย โย ย โโโ jQuery.pdf
โย ย โย ย โโโ jquery_tutorial.pdf
โย ย โโโ Node JS
โย ย โย ย โโโ Learning Node.pdf
โย ย โย ย โโโ NodeJSNotesForProfessionals.pdf
โย ย โย ย โโโ Node js.pdf
โย ย โย ย โโโ nodejs_tutorial.pdf
โย ย โโโ react-in-action.pdf
โย ย โโโ ReactJSNotesForProfessionals.pdf
โย ย โโโ ReactNativeNotesForProfessionals.pdf
โย ย โโโ You Don t Know JS by Kyle Simpson.pdf
โโโ Linux
โย ย โโโ BashNotesForProfessionals.pdf
โย ย โโโ Kali Linux Revealed.pdf
โย ย โโโ Linux Command line.pdf
โย ย โโโ LinuxNotesForProfessionals.pdf
โโโ Machine Learning & Deep Learning
โย ย โโโ A Beginners Guide to the Mathematics of Neural Networks.pdf
โย ย โโโ An Introduction to Machine Learning.pdf
โย ย โโโ Chapman_ _Hall_Crc_Machine_Learning.pdf
โย ย โโโ Deep Learning for NLP.pdf
โย ย โโโ [Harrington_P.]_Machine_learning_in_action(BookZZ.org).pdf
โย ย โโโ Introduction to ml+time series.pdf
โย ย โโโ Logistic Regression.pdf
โย ย โโโ Machine Learning For Dummies.pdf
โย ย โโโ master_machine_learning_algorithms.pdf
โย ย โโโ Mathematics for ML.pdf
โย ย โโโ MLND+2-Term+Syllabus.pdf
โย ย โโโ Ng_MLY01_13.pdf
โย ย โโโ PYTHON_DEEP_LEARNING.pdf
โย ย โโโ SLR_Leastsquares.pdf
โโโ Python
โย ย โโโ Django
โย ย โย ย โโโ Aratyn T. - Building Django 2.0 Web Applications - 2018.pdf
โย ย โย ย โโโ djangoapibook.pdf
โย ย โย ย โโโ djangobook.pdf
โย ย โย ย โโโ django_cheatsheet.pdf
โย ย โย ย โโโ django-intro.pdf
โย ย โย ย โโโ Django Projects Blueprint.pdf
โย ย โย ย โโโ Leanpub.Tango.With.Django.pdf
โย ย โโโ LPTHW.pdf
โย ย โโโ Modern Python Cookbook.pdf
โย ย โโโ Python for Informatics.pdf
โย ย โโโ PythonNotesForProfessionals.pdf
โย ย โโโ Python Web Scraping
โย ย โย ย โโโ Python Web Scraping - Second Edition [eBook].pdf
โย ย โย ย โโโ scrapy_tutorial.pdf
โย ย โโโ Violent Python.pdf
โโโ Special
โย ย โโโ AndroidNotesForProfessionals.pdf
โย ย โโโ AN INTENSIVE\012INTRODUCTION TO\012CRYPTOGRAPHY.pdf
โย ย โโโ Computer Networking.pdf
โย ย โโโ Getting_Started_with_Go_for_Data_Structures_and_Algorithms.pdf
โย ย โโโ GitNotesForProfessionals.pdf
โย ย โโโ good_concepts.pdf
โย ย โโโ HackerRank_Checklist-for-Screening-Back-End-Developers.pdf
โย ย โโโ HackerRank_Checklist-for-Screening-DevOps.pdf
โย ย โโโ HackerRank_Checklist-for-Screening-Front-End-Developers.pdf
โย ย โโโ HackerRank_Checklist_Screening-Full-Stack.pdf
โย ย โโโ HackerRank-Junior-Senior-Developer-Hiring-Checklist.pdf
โย ย โโโ Hackers Underground.pdf
โย ย โโโ How_to_earn_10_000_while_learning_to_code_-_3rd_Edition.pdf
โย ย โโโ iOSNotesForProfessionals.pdf
โย ย โโโ Matters Computational.pdf
โย ย โโโ MongoDBNotesForProfessionals.pdf
โย ย โโโ PowerShellNotesForProfessionals.pdf
โย ย โโโ Rest API.pdf
โโโ Unclassified Programming Languages
โโโ CSharpNotesForProfessionals.pdf
โโโ HaskellNotesForProfessionals.pdf
โโโ JavaNotesForProfessionals.pdf
โโโ KotlinNotesForProfessionals.pdf
โโโ ObjectiveCNotesForProfessionals.pdf
โโโ php_tutorial.pdf
โโโ RubyOnRailsNotesForProfessionals.pdf
โโโ SwiftNotesForProfessionals.pdf
19 directories, 120 files
Well ofc I utilised this off-time to start reading some of them.
In this post I share some of the interesting things I got to know through these, This post is going to be quiet long ๐, so if you are not that patient you can jump to conclusion which suggests my 3 Takeaways from this post.
Otherwise, sit back pick up some โ
Below is a day-wise journal of some interesting things I learned & did over these 7 days.
Day 0 : Linux is ๐
- Well we all know that
cat
command right ? it is used to display contents of any file, fine ! But do you know, we also have atac
command which is also used to display contents of a file but in reverse order.
$ cat butwhy.sh
This is first line.
And
This is second line.
And you know what
This is the 3rd line.
$ tac butwhy.sh
This is the 3rd line.
And you know what
This is second line.
And
This is first line.
-
pwd
, seems familiar prints the current working directory. but it has a sister command calledpwdx
. It is used to print current working directory of a currently running process.
$ sudo pwdx 997 # process id
[sudo] password for bhupesh:
997: /
# this is the root prcess
- Do you guys are sometimes confused with the Linux file system hierarchy ๐ค looking online for what a folder contains is NOT a solution. Go to your termial and type
man hier
This will print a description of the filesystem hierarchy
Also a similar command to print a less verbose version of FS hierarchy is
man file-hierarchy
- I know this might kinda feel dumb, but i didn't know we had a simple version control in Linux built-in, running the
diff
command prints the difference between 2 files.
-
tr
, lets you translate squeeze, and/or delete characters from standard input & write them to standard output.
> ls | tr a-z A-Z
ALGORITHMS & DATA STRUCTURES
C++
COMPUTER VISION
DOTNET
GNU OCTAVE
HTML5 & CSS
JS
LINUX
MACHINE LEARNING & DEEP LEARNING
PYTHON
SPECIAL
UNCLASSIFIED PROGRAMMING LANGUAGE
The above command just translates all lowercase file names to uppercase, note that filenames are not changed.
Day 1 : Javascript is nice ๐
This day I started reading javascriptgrammar, some of the interesting things i didn't know (mind you I am not a JS programmer, but I write it sometimes)
-
Symbol()
The Symbol provides a way to define a completely unique key. It doesnโt have a constructor and cannot be initialized using new keyword. An assignment to Symbol will create a new symbol with a unique ID.
// Simple symbol
const newSymbol = Symbol();
typeof newSymbol === 'symbol' // true
// A symbol with a label
const anotherSymbol = Symbol("label");
// Each symbol is unique
const yetAnotherSymbol = Symbol("label");
yetAnotherSymbol === anotherSymbol; // false
One of the use case of symbol that it can be used to create private object properties
-
console.time()
&console.timeEnd()
This is not related to JS directly but the console API lets you time how long a piece of code executes.
- File API
You can read files in Javascript by using the
FileReader()
<input type="file" id="upload">
<script type="text/javascript">
document.getElementById('upload').addEventListener('change', readFileAsString)
function readFileAsString() {
var files = this.files;
if (files.length === 0) {
console.log('No file is selected');
return;
}
var reader = new FileReader();
reader.onload = function(event) {
console.log('File content:', event.target.result);
};
reader.readAsText(files[0]);
}
</script>
I also learned these 2 cool tricks in linux.
- Builtin debugger for shell scripts (well kinda)
You can see execution of each statement in a shell script by using the
-x
flag while invoking the script viabash
bash -x hello.sh
- To print your PC Hardware info in a nice readable format you can pass the
-html
flag inlshw
(list hardware) command
sudo lshw -html > myhardware.html
Day 2 : HTML5 is ๐ฎ
This day I had a look in HTML5 Notes For Professionals and damn I don't know HTML now.
- You can tell the browser to prefetch a URL so that it can be loaded more quickly.
<link rel="prefetch" href="">
- You can validate user input by using patterns within HTML (kinda looks like regex)
<input pattern="\d*" title="Only Numbers">
- We can sandbox (isolate) an iframe and restrict things an iframe is allowed to execute by using the
sandbox
attribute. Using this, the contents of the iframe are treated as being from a unique origin and features including scripts, plugins, forms and popups will be disabled.
<iframe sandbox src="http://example.com/"></iframe>
<!-- To allow the page to run scripts & form submission -->
<iframe sandbox="allow-scripts allow-forms" src="http://example.com/"></iframe>
Day 3 : Python is ๐ฅ
This day I explored Python Notes For Professionals
this day I have also started writing the 1st draft of this post.
Some interesting things that I learned this day:
- The
heapq
library lets you find n largest or smallest numbers in an iteratable.
>>> import heapq
>>> mylist = [120, -34, 0, 56, 444, 78]
>>> heapq.nlargest(2, mylist)
[444, 120]
# notice the order
>>> heapq.nsmallest(3, mylist)
[-34, 0, 56]
>>>
This can be very useful for those who for say do competitive programming in python ๐
- Python's Default JSON Pretty Printer,
You can invoke the
json.tool
from command line to pretty print a json file
python -m json.tool journal.json
# sample output :)
{
"journal": [
{
"day0-activity": "I slept"
},
{
"day1-activity": "I slept"
},
{
"day2-activity": "I watched Avengers Endgame"
}
]
}
Tip ๐ฉ
You can also use thepprint
package to prettify things on console.
- Want to input sensitive info. at command line, don't worry Python's default library has something for you.
The
getpass
module lets you take input from user without echo'ing it to the terminal/screen.
>>> from getpass import getpass
>>> pass_in = getpass()
Password:
>>> pass_in
'iwonttellu'
>>>
Day 4 : Turn the PC off
I didn't use my PC this day, but I read this book called CodeComplete 2
Again, a previous decision saved me
I read some Software Design Characteristics, here are a few which I understood.
- Minimize Complexity Creating easy to understand designs is the key. Using designs which are not easily understood defeats the whole purpose of creating and applying Software Design Concepts.
I recently read somewhere that Netflix's Architecture is so complex that no one person can explain/describe it completely.
Source: A random YouTube video
Reusability/Extensibilty
Make sure to write code in dedicated classes/modules/packages so that someone (or you) can easily extend them sometime in future.
The best example of this is how the FOSS community has grown over these years by creating things which use reusable components or are extended from each other. Most (i bet 80%) of the popular technologies you use are somehow using OpenSource software thus enabling reusability.Loose Coupling
Coupling means how different programs/classes are connected together. Coupling should be minimum because it minimizes work during intergration, testing & maintenance.
Soo far trying to do this, I think it is atleast a bit hard for beginners,
- Portability It means what it spells, a system should be designed (& developed) so that it can be ported to a different environment easily.
For e.g you can start simply by structuring your code well, developing in Virtual Environments or use more fancier alternatives like docker.
Day 5 : The execution ๐ท day
- You remember the
tac
command we learned on Day 0 ? here is a simple implementation of the same in python
#!/usr/bin/env python3
"""Simple implementation of tac"""
import sys
def main():
if sys.argv[1] is not None:
with open(sys.argv[1], "r") as fp:
file = fp.readlines()
file.reverse()
for line in file:
print(line, end='')
if __name__ == '__main__':
main()
A sample run
> python3 tac.py hello.sh
expr 2 + 2
echo "Hello World"
> tac hello.sh
expr 2 + 2
echo "Hello World"
>
- Do you remember that we discovered the
FileReaderAPI
in Javascript on Day 1 ? I thought this is the time I need to create a pretty basic version of a Simple Notepad Here it is, and the source (i know it looks ugly)
Tip ๐ฉ
If you are on a Debian or Ubuntu based system, you can run thebrowse
command to open files and URLs.
For exbrowse https://bhupesh.codes
will open my website in your default web-browser.
Day 6 : Functional Programming
This day I explored & compared functional programming concepts in C++, JS & Python.
In all these 3 languages we have some sort of methods/functions available to do the 3 basic things that generally power functional programming i.e
- map: do(map) some operation on a set of items
- filter: filter/return some items which match a criteria
- reduce: reduce the set of items to a single value.
Here is a brief overview of the 3 concepts in C++ ๐.
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
void print(int n){
std::cout << n << " ";
}
int main(){
std::vector<int> v{20, 0, -1, 100, 5};
std::vector<int> v2, v3;
std::cout << ".....map.....\n";
std::cout << "for_each() demo\n";
// map an operation on a set of elements
for_each(v.begin(), v.end(), print);
transform(v.begin(), v.end(), back_inserter(v2), [](int n) { return n * 2 ;});
std::cout << "\ntransform() demo\n";
for_each(v2.begin(), v2.end(), print);
std::cout << "\n\n.....reduce.....\n";
std::cout << "accumulate() demo\n";
// reduce the elements to a single value, by default accumulate() sums all elemets, if no other operation is specified
int sum_vector_v2 = accumulate(v2.begin(), v2.end(), 0);
std::cout << sum_vector_v2 << "\n";
std::cout << "\n.....filter.....\n";
std::cout << "copy_if() demo\n";
// filter elements which are divisible by 5
copy_if(v2.begin(), v2.end(), back_inserter(v3), [](int a) { return a % 5 == 0; });
for_each(v3.begin(), v3.end(), print);
return 0;
}
3 Takeaways
This offline time strengthen my views on few things, I summarized some of them below.
1. Be offline for a day atleast ๐
I am sure we all have important things to do, and developers per say are always connected to the web, its time to take a break.
I have seen people taking a break from Social Media, that's great but you know what, cut-off the internet entirely & don't do any Internet related work for a day (includes no binge watching).
Relax, Meditate, Play with your pet, Practice things that you can do offline
2. Just Read ๐
You by now have already seen a ton of posts telling you that reading is a good habit, everyone should do it.
They are 100% โ
I know not everyone likes to read but you can atleast read a chapter in 2 days, hell our ancestors used to read to impart & share knowledge.
There is also one strong reason why you should read as an aspiring dev.
For e.g. there are professional people who have clubbed their advice, suggestions & best practices into 1 big piece of thing called a "book". This book contains valuable info. that you would probably never find on Internet.
3. Keep a small journal/blog ๐
Its upto you what you want to keep in this journal, you could go ahead and create a til(today i learned) repo just like me ๐
This also means that you should start your own blog (if you are reading this on DEV, then you are halfway there).
There are no restrictions on your blog, it doesn't needs to be 1000 words, nobody is going to bother you in any way on what you write or share, its your personal space on internet.
No problem if you are writing once a month (unless you want to earn ๐ค from it), as i said your blog, your choice.
Insight ๐ก
Over the past year my writing has improved (I started Aug 2019) & I have gain a lot just by writing for instance I am no longer confused with my project ideas and slowly I have started enjoying this.
If you have no idea what to write here are some example scenarios that might help.
- Something you learned today.
- Something you made (literally anything).
- You got a job/internship & how did you got it & what helped.
- You solved an interesting problem.
- You helped someone.
- Tricky bug you fixed.
- Contributed to FOSS (how, what & why)
- That feature that took days to implement & how did you do it.
- List of things/tools that make your life easier (as a dev).
- Read/Watched an interesting thing on internet (Your reaction, views, takeaways from it)
Tip ๐ฉ
If you steal or copy something from internet, try to cite the original source.
Your blog will eventually become Journal of things you learned and wanted to share with the world.
I hope you enjoyed or probably learned something. If you guys have any feedback or want to talk feel free to comment below ๐.
You can reach me directly on Twitter | Telegram | Email
Posted on April 1, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.