Skip to content

Instantly share code, notes, and snippets.

View tanaypratap's full-sized avatar
💭
writing books these days.

Tanay Pratap tanaypratap

💭
writing books these days.
View GitHub Profile
cp `ls -SF | grep .log` /path/to/where/you/want/to/copy
Note 1: notice the backtick it's not inverted comma
Note 2: if you want to copy only files ending with .log for example, training1.log (yes) but training2.log.gz (no)
then use $ like:
cp `ls -SF | grep .log$` /path/to/where/you/want/to/copy
## When downloaded some serials have long names like DareDevil.S02.E09
## This program removes the statring Daredevil.S02. from the filename as it is already there on the folder.
import os
folder_path = "D:\\marvel daredevil\\"
file_extension = ".mp4"
episode_number_at_index = 2
for file in os.listdir(folder_path):
@tanaypratap
tanaypratap / Python Important Links
Created November 21, 2016 10:09
Important links for Python
const addCounter = (list) => {
return [...list, 0];
};
const removeCounter = (list, index) => {
return [
...list.slice(0, index),
...list.slice(index + 1)
];
};
@tanaypratap
tanaypratap / index.html
Created September 7, 2017 10:40
Cache Busting CSS file on change in webpack using HtmlWebpackplugin
<link rel="stylesheet" href="/index_style.css?_=<%= htmlWebpackPlugin.options.cssVersion %>">
@tanaypratap
tanaypratap / design.html
Created March 17, 2019 10:56
Design for expense app
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
@tanaypratap
tanaypratap / create-pages-blogs.js
Created April 6, 2019 07:09
Creating Pages in Gatsby from different data sources and template
/** extracted page creation functionality into smaller functions **/
const path = require('path');
function createBlogPostsPages(result, createPage) {
const blogPostTemplate = path.join(__dirname, `../src/templates/blog-post.js`);
const blogPosts = result.data.blogs.edges;
blogPosts.forEach((post, index) => {
const previous = index === blogPosts.length - 1 ? null : blogPosts[index + 1].node;
@tanaypratap
tanaypratap / microsoft-hiring.md
Last active June 12, 2020 07:19
For Microsoft Hiring related queries

I work at Microsoft

Yes, but I'm not the point of contact for hiring

tldr I would love to help. But Microsoft HR is the right place to get help around hiring queries. I am just someone who teaches people how to code and I would like to dedicate my energy into that.

Why you ended up on this page?

If you're reading this chances are you pinged me on some social media platform to enquire about Microsoft's hiring process. I'm living a public life on Internet and this might seem like a good idea. But for a second, let's practice empathy for me.

Practice Empathy for Tanay

  1. I want to help as many people as I can. All this content I create is for free, I get no money paid from anywhere for this.
  2. I have good number of connections, followers across Internet. My weekly reach is close to 100,000. I can't fathom how I can reply if everyone pings me individually.
@tanaypratap
tanaypratap / personal-favors.md
Last active January 15, 2020 15:18
If you need my personal time, please read this

Dear Reader,

some Context

Why are you here? You got this link in some chat or comment because you asked me to spend my personal time on something. If that's the case, please read as to why I am unable to do it. After that I have also provided answers to common questions/requests which I generally get and how my content or community can be helpful.

Why I can't spend 1:1 time? I have a full time job. A job which has its own responsiblities. My social media presence or my free courses are of my goodwill. Nobody, literally nobody pays me for doing this.

Now, I have 50K+ followers across various channels and I try put my learnings out there as much as I can. It is impossible for me to do these small favors which people ask. I know it takes a lot of courage to ask, I respect that. I am also not denying that I can be helpful. But understand that this will not scale.

@tanaypratap
tanaypratap / tg_bot_ideas.md
Last active October 23, 2019 05:54
Telegram Welcome Bot Ideas

#TeamTanay TG bot

TODO : Mention in comments what you think should be included in the bot messages and options