Skip to content

Instantly share code, notes, and snippets.

View bibekgupta3333's full-sized avatar
🌐
Working On Inter Networks

Bibek Gupta bibekgupta3333

🌐
Working On Inter Networks
View GitHub Profile

Vagrant Cheat Sheet

add image

local

$ vagrant box add {title} {url}
$ vagrant init {title}
$ vagrant up
@bibekgupta3333
bibekgupta3333 / kubernetes-cheatsheet.md
Created March 21, 2023 08:23
kubernetes-cheatsheet

Kubernetes Cheat Sheet

A cheat sheet for Kubernetes commands.

Kubectl Alias

Linux

alias k=kubectl

Bash Cheat Sheet

A cheat sheet for bash commands.

Command History

!!            # Run the last command

touch foo.sh

Git-Cheat-Sheet

A cheat sheet for uncommon Git commands

Configuration

Command Description
git config --global user.name "foo" Set user name
git config --global user.email "foo@example.com" Set user email

Branches

@bibekgupta3333
bibekgupta3333 / compose-dockerFile.md
Created March 19, 2023 14:42
docker-compose-and-dockerfile

Compose skeleton

services:
  # docker run -d -p 27017:27017 --net mongo-net -e MONGO_INITDB_ROOT_USERNAME=root -e MONGO_INITDB_ROOT_PASSWORD=password --name=mongodb -v mongo-data:/data/db mongo
  mongodb:
    image: mongo
    container_name: mongodb
    volumes:
      - mongo-data:/data/db
    ports:
@bibekgupta3333
bibekgupta3333 / mysql_cheatsheet.md
Created March 18, 2023 05:03
mysql_cheat_sheet

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@bibekgupta3333
bibekgupta3333 / docker_installation.md
Created March 18, 2023 04:42
Docker Installation

Getting Docker

Docker is available for Linux, MacOS, and Windows.

MacOS

Docker for Mac is best installed with Homebrew and Homebrew Cask. For other ways to install on MacOS, see Install Docker for Mac in Docker's docs.

brew cask install docker # Install Docker
@bibekgupta3333
bibekgupta3333 / fetcher.js
Created October 21, 2021 16:17
custom register next js
import { Fetcher } from '@commerce/utils/types'
import { FetcherError } from '@commerce/utils/errors'
import type { Response } from '@vercel/fetch'
import { getCustomerToken } from '@framework/utils'
async function getText(res: any) {
try {
return (await res.text()) || res.statusText
} catch (error) {
return res.statusText
@bibekgupta3333
bibekgupta3333 / docker_login_encrpted_credential.py
Created June 1, 2021 04:24
Encrypted Credentials and credential storage for Docker Login
Introduction
When we run docker login, we will often see a warning message that our password is saved encrypted
in the Docker configuration file.
The warning might be ignored if the account and password to the operating system is not shared
with others. However, if it is a shared account, docker login might put your docker account
and password in danger. If we check the JSON file, we would find there is an unencrypted
representing our password there.
@bibekgupta3333
bibekgupta3333 / credential.js
Created May 31, 2021 17:24
Docker pass Credential Helper on Ubuntu
Recently having docker login credentials stored in plain text on a server was bugging me.
Granted the credentials are base64 encoded but easily decoded at which point the container r
egistry is vulnerable as well. I thought using one of the credential helpers would be quick
and simple but I was mistaken.
In my case I was using the pass credential helper on a Docker Swarm manager running Ubuntu server.
Part of the problem was that docker-credential-pass is not well-documented; I found various resources
that got me most of the way there but the complete solution required info across several resources
and none of them automated it as much as I wanted.