Skip to content

Instantly share code, notes, and snippets.

View xkeshav's full-sized avatar
🟪

Keshav Mohta xkeshav

🟪
View GitHub Profile
@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;
@xkeshav
xkeshav / iteratorreturn
Created December 17, 2014 14:48
want to shorten the code
<?php
$loc = '/opt/lampp/archive/data/';
$i = 0;
latestThumb($loc);
function pre($what, $stop = false ){
echo "<pre>";
print_r($what);
echo "</pre>";
if ($stop) die;
}
@xkeshav
xkeshav / iterator.php
Created December 16, 2014 13:40
php SPL iterator practice
<?php
$project_dir = '/opt/lampp/htdocs/parixan/data';
$RealPath = realpath($project_dir);
var_dump($RealPath);
$Directory = new RecursiveDirectoryIterator($RealPath, FilesystemIterator::SKIP_DOTS | FilesystemIterator::CURRENT_AS_FILEINFO);
foreach ($Directory as $dir) {
if( $Directory->hasChildren() ) {
$ch = $Directory->getChildren();
// var_dump($ch->key());