Skip to content

Instantly share code, notes, and snippets.

View kbajpai's full-sized avatar
🏠
Working from home

Kunal Bajpai kbajpai

🏠
Working from home
View GitHub Profile
@kbajpai
kbajpai / merge
Created March 13, 2020 15:43 — forked from tmiller/merge
Bash script to merge master into all branches
#!/bin/bash
# Merges the master branch into all other branches
#
# Process:
#
# - Save the name of the current branch
# - If the current branch is not master then checkout master.
# - Pull the latest changes for master from its upstream branch.
# - Loop over each local branch.
@kbajpai
kbajpai / docker-cleanup-resources.md
Created September 3, 2019 04:04 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@kbajpai
kbajpai / InsertionSort.java
Created October 21, 2018 07:58
Insertion Sort Algorithm
public int[] Sort(int[] inp) {
int i = 1;
while (i < inp.length) {
int j = i;
int n = inp[j];
while (j > 0 && inp[j - 1] > n) {
inp[j] = inp[--j];
}
@kbajpai
kbajpai / CustomJwtHandler.cs
Created May 18, 2016 15:51
Google JWT Token Validation
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens;
using System.Linq;
using System.Net.Http;
using System.Web;
using System.Web.Configuration;
using Newtonsoft.Json;
using System.Net;
using System.Threading.Tasks;
@kbajpai
kbajpai / README.md
Last active September 17, 2015 21:23
Quick Reference Scripts

ColdFusion

cfdump

<cfif CGI.REMOTE_ADDR EQ '127.0.0.1'><cfdump var="" label=""><cfabort></cfif>

Linux

find

#Find files between timestamps
namespace Bookstore.Migrations.AuthConfig
{
using Bookstore.Models;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using System;
using System.Data.Entity;
using System.Data.Entity.Migrations;
using System.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http;
@kbajpai
kbajpai / Configuration.cs
Created August 29, 2015 07:10
Add configuration for the Initial Create
namespace Bookstore.Migrations.BooksConfig
{
using Bookstore.Models;
using System;
using System.Data.Entity;
using System.Data.Entity.Migrations;
using System.Linq;
internal sealed class Configuration : DbMigrationsConfiguration<Bookstore.Models.BooksDbContext>
{
@kbajpai
kbajpai / BookModels.cs
Created August 29, 2015 06:54
Book Class
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;
namespace Bookstore.Models
{
@kbajpai
kbajpai / ShopCartFragment.java
Created August 14, 2015 21:03
Add JavaScriptInterface to WebView
mWebView = (WebView) v.findViewById(R.id.wvShopCart);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.addJavascriptInterface(new WebAppInterface(mParent), "Android");
mWebView.loadUrl(mUrl);