Skip to content

Instantly share code, notes, and snippets.

View jigar1101's full-sized avatar
🎧
Focusing

Jigar Mehta jigar1101

🎧
Focusing
View GitHub Profile
@jigar1101
jigar1101 / migrate_repo.sh
Created November 16, 2019 06:28 — forked from mariozig/migrate_repo.sh
Migrate repo from GitLab to GitHub Full blog post @ http://ruby.zigzo.com/2015/03/23/moving-from-gitlab-to-github/
# Assume we are in your home directory
cd ~/
# Clone the repo from GitLab using the `--mirror` option
$ git clone --mirror git@your-gitlab-site.com:mario/my-repo.git
# Change into newly created repo directory
$ cd ~/my-repo.git
# Push to GitHub using the `--mirror` option. The `--no-verify` option skips any hooks.
/*
* The below code flattens an arbitrarily nested arrays
* eg:- [1,2,[3]],4] -> [1,2,3,4]
*/
//User Input - Array that is to be flattened
var arrInput = [[1,2,[3]],4]
/*
* Method to flatten an array
@jigar1101
jigar1101 / generate-random-numbers.js
Created September 12, 2018 06:32
Generating an array with random Numbers
function generateRandomNumbers(count, start, end) {
const arr = [];
for (var i=0; i<count; i++) {
arr.push(Math.round(Math.random() * (end-start)))
}
return arr;
}
// Generates an array of length 100000 with random numbers between 0 to 100
@jigar1101
jigar1101 / cassandra-syntax.txt
Last active May 26, 2018 17:16
Cassandra Installation and Dummy Keyspace and Table Syntax
Install Cassandra using https://gist.github.com/hkhamm/a9a2b45dd749e5d3b3ae
Post installation - Start the shell for cassandra using
cqlsh localhost
Create Keyspace
create keyspace demo with replication = {'class':'SimpleStrategy', 'replication_factor':1};
Use Keyspace
Use demo;
@jigar1101
jigar1101 / kafka-connect-jmx.txt
Last active February 21, 2024 03:36
Kafka Connect JMX Metrics
jmx_config_reload_failure_total
kafka_consumer_consumer_node_metrics_outgoing_byte_rate
kafka_consumer_consumer_fetch_manager_metrics_validation_engine_connect_offsets_23_records_lag_max
kafka_consumer_consumer_fetch_manager_metrics_in_dataops_tblevent_regionlist_0_records_lag
kafka_connect_connect_metrics_failed_authentication_rate
kafka_producer_producer_metrics_request_rate
kafka_producer_producer_metrics_requests_in_flight
kafka_consumer_consumer_coordinator_metrics_commit_latency_max
kafka_connect_sink_task_metrics_put_batch_max_time_ms
kafka_consumer_consumer_fetch_manager_metrics_validation_engine_connect_offsets_20_records_lag_max
@jigar1101
jigar1101 / postgres cheatsheet.md
Created December 12, 2017 13:31 — forked from apolloclark/postgres cheatsheet.md
postgres cheatsheet

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL