Skip to content

Instantly share code, notes, and snippets.

View bhumit070's full-sized avatar

Bhoomit Ganatra bhumit070

View GitHub Profile
@bhumit070
bhumit070 / docker-database-setup.sh
Created February 6, 2022 07:11
This is a basic shell script which downloads 3 database image and 2 database management tool for docker
#!/bin/bash
function pullImage() {
docker pull $1
}
function createVolumeName() {
docker volume create $1
}
@bhumit070
bhumit070 / docker-aliases
Created February 6, 2022 07:12
This is docker aliases / shortcut for shell
# Docker
# remove all containers
alias ddc='docker rm -vf $(docker ps -a -q)'
# remove all images
# alias ddi='docker rmi -f $(docker images -a -q)'
# ps all
alias dps='docker ps --all'
@bhumit070
bhumit070 / bst.js
Created April 8, 2022 08:53
BST add and delete
class Node {
constructor(value) {
this.value = value
this.left = null
this.right = null
}
}
class Tree {
constructor() {
@bhumit070
bhumit070 / settings.json
Last active April 21, 2023 06:15
vscode-settings.json
{
// Editor Related Settings
"editor.wordWrap": "off",
"editor.cursorStyle": "line",
"editor.lineNumbers": "relative",
"editor.autoClosingQuotes": "always",
"editor.suggestSelection": "first",
"editor.autoClosingBrackets": "always",
"editor.autoSurround": "languageDefined",
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
@bhumit070
bhumit070 / Podfile
Last active April 21, 2023 06:14
Hermes Engine Fix While Pod Install
installer.aggregate_targets.each do |aggregate_target|
aggregate_target.user_project.native_targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['LIBRARY_SEARCH_PATHS'] = ['$(SDKROOT)/usr/lib/swift', '$(inherited)']
end
end
aggregate_target.user_project.save
end
@bhumit070
bhumit070 / remove_node_modules.sh
Last active April 21, 2023 06:14
Delete All node_modules in directory
find . -name "node_modules" -type d -prune | xargs du -chs # to check how much space node_modules is taking
find . -name "node_modules" -type d -prune | xargs rm -rf # to remove node_modules
@bhumit070
bhumit070 / nested_object_key.ts
Created April 9, 2023 10:48
nested object keys type
const locale = {
'en_us': {
hello: 'hello',
greetings: {
morning: 'Good Morning',
evening: 'Good Evening',
else: {
foo: 'bar'
}
},
@bhumit070
bhumit070 / event_emitter.ts
Created April 15, 2023 05:10
Type safe event emitter
type Listener<Args extends Array<any>> = (...args: Args) => void;
class MyEmitter<EventMap extends Record<string, Array<any>>> {
private eventListeners: {
[K in keyof EventMap]?: Set<Listener<EventMap[K]>>;
} = {};
constructor() {}
on<K extends keyof EventMap>(
#!/bin/bash
function ss() {
local screenName="$1"
if [ -z "$screenName" ]; then
echo "No service name provided."
exit 1
fi
local isScreenRunning=$(screen -ls | grep -ciw "$screenName")
@bhumit070
bhumit070 / nodejs_debug_vscode.json
Created April 21, 2023 17:43
Vscode NodejS Debugger
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Node",
"port": 9229,
"request": "attach",
"skipFiles": ["<node_internals>/**"],
"envFile": "${workspaceFolder}/.env",
"type": "node"