Skip to content

Instantly share code, notes, and snippets.

View lakshmankashyap's full-sized avatar
🏠
Working from home

Lakshman lakshmankashyap

🏠
Working from home
View GitHub Profile
@lakshmankashyap
lakshmankashyap / elasticsearch-example.js
Created September 14, 2022 05:16 — forked from vrsandeep/elasticsearch-example.js
Simple example how to use elastic search with node.js using standard and ngram tokenizer
'use strict';
var elasticsearch = require('elasticsearch');
var log = console.log.bind(console);
var client = new elasticsearch.Client({
host: 'localhost:9200',
log: 'trace'
});
#!/bin/bash
###################################
# Usage: sudo ./installer.sh [os] #
###################################
OS=$1;
UBUNTU="ubuntu";
#############
@lakshmankashyap
lakshmankashyap / near-js.md
Created January 5, 2022 05:49 — forked from zurgl/near-js.md
some near stuff
const { connect, keyStores } = require("near-api-js");
const path = require("path");
const homedir = require("os").homedir();
const nacl = require("tweetnacl");
const sha256 = require("js-sha256");

const ACCOUNT_ID = "near-example.testnet";
const CREDENTIALS_DIR = ".near-credentials";
@lakshmankashyap
lakshmankashyap / test.js
Created January 5, 2022 05:48 — forked from zurgl/test.js
test solana service
// first install @solana "@solana/web3.js"
// yarn add @solana/web3.js
import {
Connection,
clusterApiUrl,
Keypair,
LAMPORTS_PER_SOL,
PublicKey,
} from '@solana/web3.js';
@lakshmankashyap
lakshmankashyap / mint.js
Created January 5, 2022 05:46 — forked from zurgl/mint.js
solana js examples
const web3 = require('@solana/web3.js');
const splToken = require('@solana/spl-token');
(async () => {
//create connection to devnet
const connection = new web3.Connection(web3.clusterApiUrl("devnet"));
//generate keypair and airdrop 1000000000 Lamports (1 SOL)
const myKeypair = web3.Keypair.generate();
'use strict'
const autocannon = require('autocannon');
let jsf = require('json-schema-faker');
let schema = {
type: 'object',
properties: {
id: -1,
Info: {
@lakshmankashyap
lakshmankashyap / Install_robo3t_Ubuntu.md
Created November 11, 2021 10:02 — forked from abdallahokasha/Install_robo3t_Ubuntu.md
Install Robo3t on Ubuntu18.04 and make a desktop icon for it

Install Robo3t On Ubuntu 18.04

Download the package form Robo3t or using wget
wget https://download.robomongo.org/1.2.1/linux/robo3t-1.2.1-linux-x86_64-3e50a65.tar.gz
Extract here using

tar -xvzf robo3t-1.2.1-linux-x86_64-3e50a65.tar.gz

@lakshmankashyap
lakshmankashyap / README.md
Created April 1, 2021 09:42
Node.js interview questions

Node.js interview questions

What is the architecture of node?

Application & Modules

This is where you write your application & installed modules live. Usually they are written in plain Javascript.

C/C++ bindings

@lakshmankashyap
lakshmankashyap / findDatesInRange.js
Created August 17, 2020 13:32 — forked from cschlyter/findDatesInRange.js
MongoDB: Find dates in a range.
var start = new Date(2013, 5, 4)
var end = new Date(2013, 5, 6)
db.mention_stat.find({"verification": {"$gte": start, "$lt": end}})
@lakshmankashyap
lakshmankashyap / mongo_group_by_day.js
Created August 17, 2020 13:32 — forked from cschlyter/mongo_group_by_day.js
MongoDB: group by day (aggregate)
var mention_id = 620996;
db.mentionStats.aggregate([
{ $match: {'mention_id': mention_id}},
{ $group: {'_id': {
'year': { '$year': "$verification_date" },
'month': { '$month': "$verification_date" },
'day': { '$dayOfMonth': "$verification_date" }
},
'retweets': { $last: "$retweets" }}},