Skip to content

Instantly share code, notes, and snippets.

View sivaram143's full-sized avatar

Sivaram Nyayapati sivaram143

  • Hyderabad
View GitHub Profile
const userLocale = navigator.languages && navigator.languages.length ? navigator.languages[0] ?? 'en' : navigator.language ?? 'en';
console.log(userLocale);
- https://dev.to/jeetvora331/3-cool-developer-console-tricks-you-must-know-1ncc
- https://www.sitepoint.com/webpack-vite-migration/

Kubernetes References

Steps to reset password directly from mongo shell


  • Get the salt field from users collection

  • Use the node command with the user.salt to encrypt new passwrod

    node>
    > require("crypto").createHmac("sha256", SALT) +  "").update("<pwd>").digest("hex")
    
/*
File: mongo-commands.js
Basic mongo Commands executed via script file
Usage:
$ mongo < mongo-commands.js
*/
// showing the existing dbs..
show dbs
-- File: sql-commands.sql
-- Basic Sql Commands executed via script file
-- Usage:
-- $ mysql -u root -p < sql-commands.sql
-- # if already running in mysql
-- mysql> source sql-commands.sql
-- list databases
show databases;
# script on command line arguments
# Usage: $ bash cli.sh <arg1> <arg2> ...
# multi-line comments
<<COMMENT
$@/$* : contains all the arguments
$0 : script name
$1,$2...$9 : positional parameters repr. arguments
$n : Nth argument
$# : total no.of arguments
$$ : pid of current shell
# simple script on input && output
# Usage: $ bash io.sh (or)
# $ chmod +x io.sh $ ./io.sh
#!/bin/bash
# prints the string to stdout
echo "Enter Your Name:?"
# to read input from keyboard stores 'name' in name varaible
#!/bin/bash
# sysinfo_page - A script to produce an HTML file
# Usage : sh test.sh > test.html
# Open 'test.html' in browser
title="System Information for"
cat <<- _EOF_
// Usage: mongo localhost/{DBName} mongo-list.js
var collections = db.getCollectionNames();
print('Collections inside the db:');
for(var i = 0; i < collections.length; i++){
var name = collections[i];
if(name.substr(0, 6) != 'system')
print(name + ' - ' + db[name].count() + ' records');