Skip to content

Instantly share code, notes, and snippets.

View Bhupesh-V's full-sized avatar
🤔
Do I know what I am doing? No

Bhupesh Varshney Bhupesh-V

🤔
Do I know what I am doing? No
View GitHub Profile
@Bhupesh-V
Bhupesh-V / scd-completions.bash
Last active August 17, 2020 14:18
scd : switch directories from anywhere to anywhere
#!/usr/bin/env bash
# How to use:
#
# 1. Start a new bash session
# 2. source the completions script "source scd-completions.bash" or Copy the script in /etc/bash_completion.d/
# for automatic loading
# 3. scd <search-string>[TAB][TAB]
#
@Bhupesh-V
Bhupesh-V / scd.sh
Created August 13, 2020 09:32
smart cd - Change directories smartly [v2]
scd() {
# [s]mart cd : find absolute paths & automatically switch to them
if [[ $1 != "" ]]; then
case $1 in
[".."]* ) cd .. || exit;;
["-"]* ) cd - || exit;;
["/"]* ) cd / || exit;;
* ) while read -r value; do
files+=($value)

C++ Alternatives to Python

  1. startswith()
std::string s = "tititoto";
if (s.rfind("titi", 0) == 0) {
  // s starts with prefix
}
@Bhupesh-V
Bhupesh-V / html-template.html
Last active April 30, 2024 08:55
A Sample HTML Template for better SEO
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<meta name='viewport' content="width=device-width,height=device-height, initial-scale=1, shrink-to-fit=yes">
<!--theme colors -->
<meta name="theme-color" content="" />
# Demo Scheduler Program
import schedule
import time
def job():
print("Today is " + day + " and time is " + t)
day = str(input("Enter Day(sunday/monday etc) : "))
t = str(input("Enter Time (hh:mm) : "))
#!/usr/bin/env python
''' Simple script to auto-generate the README.md file for a til project.
NOTE: Someone who wanted to be fancy would actually use a template engine
for this, but this seemed like a task for which it is best to only require
python. This is not a general purpose script, but tailored for the format
being used for "Today I Learned" repos.
Apply as a git hook by running the following command in linux:
cd .git/hooks/ && ln -s ../../createReadme.py pre-commit && cd -
'''
from __future__ import print_function
@Bhupesh-V
Bhupesh-V / extract.md
Last active September 29, 2021 04:18
Extract The Unique Image ID from Google Drive URL

Extract The Unique Image ID from Google Drive URL

Usage

python3 extract.py <drive_image_url>

Demo

The ID as a string, Example :

python3 extract.py https://drive.google.com/file/d/0BwZFRt1DatLLZUt4eF94dFh1ZXJubUthenY3MVZERU5yeV9z/view\?usp\=sharing

@Bhupesh-V
Bhupesh-V / _highlights.scss
Last active May 17, 2021 05:54
jekyll-now Code Monokai Theme. Just copy paste the following code under _sass directory in _highlights.scss file
pre.highlight {
background-color: #282923;
padding: 7px 7px 7px 10px;
border: 20px solid yellowgreen;
-moz-box-shadow: 3px 3px rgba(0,0,0,0.1);
-webkit-box-shadow: 3px 3px rgba(0,0,0,0.1);
box-shadow: 3px 3px rgba(0,0,0,0.1);
margin: 20px 0 20px 0;
overflow: auto;

Follow below steps to use a Google Form as a Feedback Form ;)

  1. Make a Google form having exactly the same fields as on your website.
  2. Once you do this , generate a link of the prefilled form , you will get the option by clicking onn the 3 dots
  3. The Generated URL may look somewhat like this
<!--
https://docs.google.com/forms/d/e/1FAIpQLSfim3RiM1NLrTszkwOv2uJ8mFMfZR6WZU-qKK6oRUlgA9vjuw/viewform?usp=pp_url&entry.389706550=Karma&entry.1867581834=Bitch&entry.973008035=Hellllllllooooo
-->