Skip to content

Instantly share code, notes, and snippets.

View ns23's full-sized avatar
🎯
Focusing

Nitesh Sawant ns23

🎯
Focusing
View GitHub Profile
@ns23
ns23 / javascript.md
Created June 4, 2018 07:49
Resources for developers
@ns23
ns23 / snippet.md
Created June 4, 2018 05:34
Replace all html comments
(?s)<start tag>.*?<end tag>

For example, to remove all HTML comments:

(?s)<!--.*?-->

@ns23
ns23 / website_blocker.py
Created April 15, 2018 11:29
A website blocker using python
import time
from datetime import datetime as dt
start_time = 8
end_time =18
def calculate_sleep_time():
if dt(dt.now().year, dt.now().month, dt.now().day, start_time) >= dt.now():
print("if block")
diff = dt(dt.now().year, dt.now().month, dt.now().day, start_time)-dt.now()
@ns23
ns23 / imgCompress.py
Created August 22, 2017 05:50
A python script to compress all the images in the folder
import piexif
import os
from PIL import Image
Copyright = "Paresh Sawant" # add name of copyright holder
Artist = "Paresh Sawant" # add name of attist
quality = 70
def get_images(path):
@ns23
ns23 / main.js
Created August 16, 2017 06:07
JavaScript-Retrieve all videos from YouTube playlist using youtube v3 API
let Youtube = require('./youtube');
let playlist1 = new Youtube();
let listId = 'PL6gx4Cwl9DGBMdkKFn3HasZnnAqVjzHn_';
playlist1.parsePlaylist(listId).then(function(res) {
console.log(res); //list of videos in youtue playlist
}).catch(function(error) {
console.log(error);
});
@ns23
ns23 / parseYoutubeUrl.js
Created August 11, 2017 11:39
Check YouTube URL is video or playlist URL
/*
You need node installed on your system for code to run
*/
var m_url = require('url');
function parseUrl(value) {
m_web_url = m_url.parse(value, true);
m_video = m_web_url.query.v;