Skip to content

Instantly share code, notes, and snippets.

View AliKhadivi's full-sized avatar
👨‍💻
Learning....

Ali Khadivi AliKhadivi

👨‍💻
Learning....
View GitHub Profile
@AliKhadivi
AliKhadivi / containerd.sh
Last active November 10, 2023 08:31
Build Containerd Debian Package
#!/bin/bash
# Set Containerd version
export "containerd_version=1.7.8"
export "runc_version=1.1.10"
export "cni_version=1.3.0"
export "nerdctl_version=1.7.0"
export "folder=$(pwd)/containerd.io"
mkdir -p "${folder}"

Git Learning

Git Concepts

  • Remote: A remote in Git refers to a repository hosted on a different server, which can be accessed and interacted with over the internet. Remotes allow collaborative development and sharing of code between multiple contributors. Common remote repositories include GitHub, GitLab, and Bitbucket.

  • Origin: "Origin" is the default name often given to the main remote repository where you cloned or originated your local repository from. It represents the remote repository's URL, and you can fetch, pull, and push changes to/from it.

FROM ubuntu:20.04
# Install prerequistes since it is needed to get repo config for SQL server
USER root
ENV ACCEPT_EULA=Y \
DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -yq curl apt-transport-https gnupg2 && \
# Get official Microsoft repository configuration
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
curl https://packages.microsoft.com/config/ubuntu/20.04/mssql-server-2022.list | tee /etc/apt/sources.list.d/mssql-server.list && \
@AliKhadivi
AliKhadivi / mssql-tools.Dockerfile
Last active March 23, 2023 12:23
Dockerfile for SQL Server tools (sqlcmd, bcp, mssql-scripter) using Docker
FROM ubuntu:18.04
ARG DEBIAN_FRONTEND=noninteractive
ARG ACCEPT_EULA=Y
RUN apt update && apt install curl gnupg2 ca-certificates -y && \
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list | tee /etc/apt/sources.list.d/msprod.list && \
apt update && apt upgrade -y && \
apt install mssql-tools unixodbc-dev python3 python3-pip libunwind8 libssl1.0 -y && \
#!/usr/bin/env bash
# color codes
green='\033[0;32m'
red='\033[0;31m'
yellow='\033[0;33m'
cyan='\033[0;36m'
reset='\033[0m'
# Show error message and exit
@AliKhadivi
AliKhadivi / jwt.cs
Last active September 22, 2023 12:05
C# JWT HS256
public enum JwtStatusCode
{
OK,
NotSupported,
NotVaild,
SignNotVaild,
Expired,
UnknownError
}
public class JwtToken

Install Kubernetes

Install and configure prerequisites

sudo apt update
sudo apt upgrade -y
sudo apt install -y ca-certificates curl gnupg lsb-release
cat <<EOF | sudo tee /etc/modules-load.d/containerd.conf
overlay
br_netfilter
@AliKhadivi
AliKhadivi / LiteDB CRUD ASP.NET.cs
Last active July 11, 2022 11:41 — forked from garymedina/LiteDB CRUD ASP.NET
LiteDB Crud operations and path for use in ASP.NET
//ASP.NET Database path
var path = Server.MapPath("~/App_Data/site.db");
using (var db = new LiteDatabase(path))
{
//Sets or Creates a Table in DB
var bottles = db.GetCollection<Bottle>("Bottles");
//Creates a new bottle object and saves in db
sudo apt update && sudo apt install -y zsh git curl wget vim fzf
sudo git clone https://github.com/ahmetb/kubectx /opt/kubectx
sudo ln -s /opt/kubectx/kubectx /usr/local/bin/kubectx
sudo ln -s /opt/kubectx/kubens /usr/local/bin/kubens
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
curl -L https://gist.githubusercontent.com/AliKhadivi/7a37c2ded63aaae904960663982431b2/raw/ > ~/.oh-my-zsh/custom/themes/jalgo.zsh-theme
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
curl -L https://gist.githubusercontent.com/AliKhadivi/5a23c205e927a6c9e85d27c95f0123ed/raw >> ~/.vimrc
set number
set cursorline
" Plugins will be downloaded under the specified directory.
call plug#begin(has('nvim') ? stdpath('data') . '/plugged' : '~/.vim/plugged')
" Declare the list of plugins.
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'