Skip to content

Instantly share code, notes, and snippets.


Abhinav Kulshreshtha Abhinav1217

View GitHub Profile
Abhinav1217 / javascript: getDateRangeOfWeek.js
Last active Jul 21, 2021
Get date range based on week number.
View javascript: getDateRangeOfWeek.js
* Get the date and days within a week from week number.
* eg: date range for 8th week in 2013 is 17th Feb to 23rd Feb. This
* code snippet will give you.
* It is not my code completely, Bit of modification from something
* i found on net. Cant find it anymore so keeping a backup.
* @param {[Integer]} weekNo [From week 1 to Week 52/53 based on the system date setting]
* @return {[Date]} [description]
Abhinav1217 /
Last active Feb 8, 2021
Network Test on API 29 - Java
package com.example.simplenetwork;
import android.content.Context;
import android.util.Log;
Abhinav1217 /
Created Jul 29, 2020 — forked from jonlabelle/
Bash script to search file contents (by file extension) for the specified search term. Uses grep under the hood.
#!/usr/bin/env bash
# shellcheck disable=SC2034,SC2086,SC2155,SC2001,SC2048
# Search file contents (by file extension) for the specified search term.
# grep options:
# -i Perform case insensitive matching.
# −r Recursively search subdirectories listed.
Abhinav1217 /
Last active Jul 12, 2020
youtube-dl aliases for stuffs
# Some youtube-dl shortcuts and workarounds.
# Download MP3
alias youtube-dl-mp3="youtube-dl --extract-audio --audio-format mp3 "
# Youtube playlist which is organised in folders and Videos are numbered.
# use youtube-dl-playlist -f 22 <link>
alias youtube-dl-playlist='youtube-dl -o "./%(playlist_title)s/%(playlist_index)s_%(title)s.%(ext)s" '
# Youtube-dl to download from hotstar.
# Removes old revisions of snaps
set -eu
LANG=en_US.UTF-8 snap list --all | awk '/disabled/{print $1, $3}' |
while read snapname revision; do
Abhinav1217 / sumByLong.kt
Created Apr 20, 2020
sumByLong() polyfill and similar options.
View sumByLong.kt
// Kotlin have sumBy:Int and sumByDouble:Double but many of us work with Long which is missing.
// This is an implementation based on stdlib for sumbydouble
// Save this in your util to make this accessable.
inline fun <T> Iterable<T>.sumByLong(selector: (T) -> Long): Long {
var sum = 0L
for (element in this) {
sum += selector(element)
return sum
Abhinav1217 / Fetch.sublime-settings.json
Last active Jan 18, 2020
My nettuts fetch sublime setting file
View Fetch.sublime-settings.json
"Angular JS": "",
"Backbone.js": "",
"CSS-reset": "",
"Chart.js": "",
"Exoskeleton": "",
"Favicon.js": "",
"HTML5_SQL.js": "",
View vscode-keybindings.jsonc
// Place your key bindings in this file to override the defaults
// Make sure you disable/replace old keybindings or else Code can misbehave.
// Use "-" in command if you need to disable any keybinding.
// All keybindings must be either scoped or unique.
// Setup advanced-new-file - Need to make my own one day
"key": "ctrl+n",
"command": "extension.advancedNewFile"
View _brightness.scss
// Brightness math based on:
$red-magic-number: 241;
$green-magic-number: 691;
$blue-magic-number: 68;
$brightness-divisor: $red-magic-number + $green-magic-number + $blue-magic-number;
@function sqrt ($r) {