Skip to content

Instantly share code, notes, and snippets.

View imbdb's full-sized avatar
🎯
Focusing

Bharat D Bhadresha imbdb

🎯
Focusing
View GitHub Profile
@imbdb
imbdb / get_formatted_date.js
Last active November 8, 2019 06:46
Takes a native date object and returns string containing date the specified format
/*
Takes a native date object and returns string containing date the specified format
Format segments are
{{dd}} - 2 digit date
{{D}} - Day of week
{{mm}} - 2 digit month
{{mmm}} - 3 letter month
{{MMM}} - Full month
{{yyyy}} - 4 digit year
{{H}} - 2 digit hour (24 hours)
@imbdb
imbdb / webkit-scrollbar.css
Created July 12, 2019 13:53
design-scrollbar-webkit
*::-webkit-scrollbar-track {
background: rgba(255,255,255,0.08);
}
*::-webkit-scrollbar-thumb {
background-color: rgba(0,0,0,0.2);
}
*::-webkit-scrollbar {
width: 6px !important;
height: 6px !important;
}
@imbdb
imbdb / rename-to-numbers.sh
Created July 5, 2019 10:37
Rename all files to numbers
# Find all files with specified pattern using find and then mv them to new numbered name
# eg. abc.jpeg, sdfs.jpeg,... --> 0001.jpeg,0002.jpeg,...
find -iname '*.jpeg' | # find files
gawk 'BEGIN{ a=1 }{ printf "mv \"%s\" \"%04d.jpeg\"\n", $0, a++ }' | # build mv command ( Change 04d(0000) to your number your files)
bash
@imbdb
imbdb / pdf-to-png.py
Created July 5, 2019 10:33
Extract PDF pages as PNG
# Uses convert cmdline tool
import os
def main():
dir_list = os.listdir('./pdfs') # change to your pdf directory
for full_file_name in dir_list:
base_name, extension = os.path.splitext(full_file_name)
if extension == '.pdf': # then .pdf file --> convert to image!
cmd_str = ' '.join(['convert',
'"./pdfs/' + full_file_name + '"', # change to your pdf directory
@manojd929
manojd929 / mongodb-crash-course.txt
Created November 25, 2018 13:40
MongoDB crash course notes - Brad Traversy
MongoDB
NoSQL Database - Document Database Type in NoSQL
Data is stored in json like syntax
Good to use when there is no ton of inter connected relations
Database, Collections, Document
data/db folder inside MongoDB
$(selector).popover({ trigger: "manual" , html: false, animation:true})
.on("mouseenter", function () {
var _this = this;
$(this).popover("show");
$(".popover").on("mouseleave", function () {
$(_this).popover('hide');
});
}).on("mouseleave", function () {
var _this = this;
setTimeout(function () {
// Opera 8.0+
var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
// Firefox 1.0+
var isFirefox = typeof InstallTrigger !== 'undefined';
// Safari 3.0+ "[object HTMLElementConstructor]"
var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || (typeof safari !== 'undefined' && safari.pushNotification));
// Internet Explorer 6-11
@glasslion
glasslion / vtt2text.py
Last active May 31, 2024 18:51
This script convert youtube subtitle file(vtt) to plain text.
"""
Convert YouTube subtitles(vtt) to human readable text.
Download only subtitles from YouTube with youtube-dl:
youtube-dl --skip-download --convert-subs vtt <video_url>
Note that default subtitle format provided by YouTube is ass, which is hard
to process with simple regex. Luckily youtube-dl can convert ass to vtt, which
is easier to process.
@planetoftheweb
planetoftheweb / bootstrap-cdn.html
Last active April 2, 2022 17:46
Bootstrap 4 CDN template with Font Awesome
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<script defer src="https://use.fontawesome.com/releases/v5.0.2/js/all.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<!-- ADDITIONAL STYLESHEET HERE -->
<title>SITE NAME</title>
</head>
@richid
richid / Jenkinsfile
Last active February 24, 2023 15:07
Jenksfile declarative pipeline with parallel dynamic stages
def applications = env.APPLICATIONS.split(",").findAll { it }.collect { it.trim() }
def environment = env.ENVIRONMENT
def version = env.VERSION
def jobs = [:]
if (applications.size() < 1) {
error("ERROR: APPLICATIONS must be a comma-delimited list of applications to build")
}
for (int i = 0; i < applications.size(); i++) {