Skip to content

Instantly share code, notes, and snippets.

View xkeshav's full-sized avatar
🟪

Keshav Mohta xkeshav

🟪
View GitHub Profile
@xkeshav
xkeshav / .gitconfig
Created July 15, 2024 04:45 — forked from Kovrinic/.gitconfig
git global url insteadOf setup
# one or the other, NOT both
[url "https://github"]
insteadOf = git://github
# or
[url "git@github.com:"]
insteadOf = git://github
@xkeshav
xkeshav / address-list.json
Created July 14, 2024 10:38
Address which contains all alphabets and numbers
{
"addresses": [
{
"address": "1234/A, Alpha Beta Building, Near Zenith Tower, Xyz Street, Block 12, Sector 6, Gandhinagar, Ahmedabad, Gujarat - 382010",
"PIN": "123456"
},
{
"address": "56B/89, QRS Plaza, Opp. UVW Complex, A-Block, Vikas Marg, Sector 14, Gurgaon, Haryana - 122001",
"PIN": "654321"
},
@xkeshav
xkeshav / css-christmas-tree-click-to-restart.markdown
Created December 25, 2022 04:03
CSS Christmas Tree 🎄 [Click to restart]
@xkeshav
xkeshav / Ubuntu to mac OS.md
Last active April 22, 2022 06:12 — forked from zymr-keshav/Ubuntu to macOS.md
useful tweaks and tip while switching from ubuntu to macOS x

Ubuntu to Mac OS.

following are my finding while switching from ubuntu to macOS, first I describe the issue and what is the alternative in the mac OS before moving forward, let's know the version name by their number denoated as OS X

version number version name
10.10 "Yosemite"
10.11 "EI Captian"
10.12 "Sierra"
10.13 "High Sierra"
@xkeshav
xkeshav / deep-merge-object.js
Created September 29, 2021 16:54
interview questioin: how to deep merge 2 objects
const user1 = {name: 'alpha', age: 23, address: {street: 'alpha road', city: 'Pune'}, gender: {sex: 'male'}};
const user2 = {name: 'beta', age: 25, address: {street: 'beta road', state: 'Maharashtra'}};
const deepMerge = (source, target) => {
for(const [key, val] of Object.entries(source)) {
if(val !== null && typeof val === 'object') {
if(target[key] === undefined) {
target[key] = {...val}
}
deepMerge(val, target[key]);
@xkeshav
xkeshav / jumble.js
Last active September 28, 2021 14:56
Interview question: find numeral letter from a random string
const input = 'torzeonthowoereezero';
// idea here is, first check that every letter of numeral exist in the given string,
// if it exist then remove the numeral letter from given string and search for next numeral and so on
const numeral = {
'zero' : 0,
'one': 1,
@xkeshav
xkeshav / vs-code.settings
Last active September 21, 2021 16:59
VS code recommeneded user settings
{
"editor.snippetSuggestions": "top",
"editor.wordWrap": "on",
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"[html]": {
"editor.formatOnSave": true,
"editor.quickSuggestions": {
"other": true,
"comments": false,
@xkeshav
xkeshav / curl.sh
Created July 7, 2017 15:41
run curl from a file with parameter as post data and variable such as current date, random number
#!/bin/bash
# call as `sh curl.sh <uuid> <hostname>`
# exmaple sh curl.sh 595e341fd7391071d21ce1b5 20.20.1.73
header="Content-Type: application/json"
enc=$(shuf -i 0-1000 -n 1)
dec=$(shuf -i 10-600 -n 1)
now=$(date +%s%3N)
post_data=$(cat <<EOF
{
"ip_address": "$2",
@xkeshav
xkeshav / find.html
Created December 20, 2014 10:39
Search panel with help of latest CSS and all possibility taken care
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Iterator : Unit Case</title>
<!-- <link rel="stylesheet" href="fix.css"> -->
<style type="text/css">
body {
font-style: sans-serif;
@xkeshav
xkeshav / final_Iterator.php
Created December 18, 2014 15:22
Iterator file which will retrive latest image of latest folder distributed in timetamp nomeniclature of without scanning complete directory
<?php
// error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
error_reporting(E_ALL ^ E_NOTICE);
class latest {
private $basepath;
private $flags;
public $parentDir;
private $thumbDirName = 'thumbnails';
public $i = 1;