Skip to content

Instantly share code, notes, and snippets.

View AshishKapoor's full-sized avatar
💭
Here to build.

Ashish Kapoor AshishKapoor

💭
Here to build.
View GitHub Profile
@AshishKapoor
AshishKapoor / .tmux.conf
Last active November 16, 2024 15:14
tmux config
# Set the prefix to Ctrl+a
set -g prefix C-a
# Remove the old prefix
unbind C-b
# Send Ctrl+a to applications by pressing it twice
bind C-a send-prefix
# List of plugins
@AshishKapoor
AshishKapoor / linux-setup.sh
Created September 10, 2024 13:04 — forked from dhh/linux-setup.sh
linux-setup.sh
# THIS LINUX SETUP SCRIPT HAS MORPHED INTO A WHOLE PROJECT: HTTPS://OMAKUB.ORG
# PLEASE CHECKOUT THAT PROJECT INSTEAD OF THIS OUTDATED SETUP SCRIPT.
#
#
# Libraries and infrastructure
sudo apt update -y
sudo apt install -y \
docker.io docker-buildx \
build-essential pkg-config autoconf bison rustc cargo clang \
@AshishKapoor
AshishKapoor / users.json
Created May 2, 2024 07:23
Code Challenge - Users JSON File
{
"users": [
{
"name": "Karan Ahuja",
"type": 1
},
{
"name": "Suraj Singh",
"type": 0
},
@AshishKapoor
AshishKapoor / generics.ts
Last active November 30, 2023 07:47
Some examples to understand typescript generics once and for all
// Example 1 Generic Function
function convertToArrayLegacy<T>(value: T): T[] { //
return [value]
}
const convertToArray = <T extends unknown>(value: T): T[] => {
return [value]
}
@AshishKapoor
AshishKapoor / binarySearch.js
Created July 5, 2023 11:21
Binary search to find the target value in a sorted array.
function binarySearch(nums, target) {
let left = 0;
let right = nums.length - 1
while (left <= right) {
let mid = ~~((left + right)/2)
if (nums[mid] === target) return mid
if (nums[mid] < target) left = mid + 1
if (target < nums[mid]) right = mid - 1
}
@AshishKapoor
AshishKapoor / init.lua
Last active June 14, 2023 10:52
[linux] my neovim file
-- This is Ashish's NVIM Config Dotfile.
-- Set <space> as the leader key
-- See `:help mapleader`
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
-- Install package manager
#!/bin/bash
#WHILE THIS SCRIPT IS MOSTLY NON-INTERACTIVE, SOME SECTIONS DO HAVE EXPLICIT REMARKS TO EXECUTE ACTIONS! WATCH YOUR STEP HERE!
sudo apt-get update --yes
sudo apt-get dist-upgrade --yes
sudo apt-get autoremove --yes
sudo apt-get autoclean --yes
sudo apt-get install curl tmux zsh nload iotop htop git python3-dev python3-pip apt-transport-https ca-certificates software-properties-common vim mosh --yes
#Oh my TMUX
git clone https://github.com/gpakosz/.tmux.git
@AshishKapoor
AshishKapoor / guessing_game.rs
Last active April 24, 2023 09:07
Guessing Game in Rust
use rand::Rng;
use std::cmp::Ordering;
use std::io;
fn main() {
println!("Guess the number!");
let secret_number = rand::thread_rng().gen_range(1..=100);
loop {
@AshishKapoor
AshishKapoor / config.nvim.init.lua
Last active November 16, 2023 04:07
[Mac OS] my neovim config
-- This is Ashish's NVIM Config Dotfile.
-- Set <space> as the leader key
-- See `:help mapleader`
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
-- Install package manager
@AshishKapoor
AshishKapoor / diff-arr-obj.js
Created January 25, 2023 05:02
To find difference between array of objects
const arrayOne = [
{ value: "4a55eff3-1e0d-4a81-9105-3ddd7521d642", display: "Ashish" },
{ value: "644838b3-604d-4899-8b78-09e4799f586f", display: "Kapoor" },
{ value: "b6ee537a-375c-45bd-b9d4-4dd84a75041d", display: "Pulkit" },
{ value: "e97339e1-939d-47ab-974c-1b68c9cfb536", display: "Smriti" },
{ value: "a63a6f77-c637-454e-abf2-dfb9b543af6c", display: "Neeru" },
];
const arrayTwo = [
{ value: "4a55eff3-1e0d-4a81-9105-3ddd7521d642", display: "Ashish"},