Skip to content

Instantly share code, notes, and snippets.

#!/usr/local/bin/node
const fs = require('fs');
function findFiles(filePath) {
// iterate through each files to find query
// for each files, split text files by line into an array
// iterate through array to find query
// if query is found, add files path + text line num + /t + text to results
// if additional folder are inside path
I have running on 4 servers with a load balancer on 1 redis (70% cache rate) and 1 postgres DB.
//load balancer with 4 servers K6 results.
/\ |‾‾| /‾‾/ /‾/
/\ / \ | |_/ / / /
/ \/ \ | | / ‾‾\
/ \ | |‾\ \ | (_) |
/ __________ \ |__| \__\ \___/ .io
//RPS results for both DBs
PostgreSQL RPS = 1258.653249/s
Cassandra RPS = 915.124875/s
//K6 setting
export let options = {
vus: 200,
duration: "600s"
};
//postgres
review_db=# select * from reviews where product_id=1;
id | product_id | username | is_verified | review_text | score | found_helpful | title | review_date
----------+------------+--------------------------+-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------+---------------+-------------------------------------+-------------
34344251 | 1 | Kurt211 | 1 | Culpa perferendis iste sequi alias non error tempora. Molestiae tempora in animi error qu
@zkliu611
zkliu611 / installing_cassandra.md
Created January 9, 2019 19:37 — forked from hkhamm/installing_cassandra.md
Installing Cassandra on Mac OS X

Installing Cassandra on Mac OS X

Install Homebrew

Homebrew is a great little package manager for OS X. If you haven't already, installing it is pretty easy:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
below is the get request result to get all user data from database.
listening on port 4000
serving get request
[ RowDataPacket {
userId: 1,
username: 'Jackie_McKenzie',
avatarURL:
'https://s3.amazonaws.com/uifaces/faces/twitter/dzantievm/128.jpg',
followers: 1,
const hasPathToSum = function(node, targetSum) {
var findSum = (node, sum = targetSum, end = false) => {
if (end) {
if (sum === 0) {
return true;
}
}
if (node.value) {
sum -= node.value;
class CashAmount {
constructor(amount){
this.value = amount;
}
totalInPennies() {
var string = String(this.value);
if (!string.includes('.')){
string = string + '00';
}
class CashAmount {
constructor(amount){
this.value = amount;
}
totalInPennies() {
var string = String(this.value);
if (!string.includes('.')){
string = string + '00';
}
@zkliu611
zkliu611 / findLargestLevel.js
Created December 6, 2018 17:49
Largest level of Binary Tree
const findLargestLevel = function(node) {
var largestSum = null;
var largestLevel = null;
var level = 0; // level 1 represents the root level
var sum = 0;
var array = [];
var count = 0; // counts how many node from current level is in the array
array.push(node);