Skip to content

Instantly share code, notes, and snippets.

View mechbullgt's full-sized avatar
💘
Fluttering

Maqbool Ansari mechbullgt

💘
Fluttering
View GitHub Profile
@mechbullgt
mechbullgt / CreateGoogleSheetAndMailLink.gs
Last active December 8, 2018 07:25
Google App Script
@mechbullgt
mechbullgt / theDropDown.js
Created December 8, 2018 11:45
Dependent Dropdown list for Google Sheet using Google Script Editor.
/**
* Method sets a new dataValidation rule across the sheet.
*
* @param {*} range
* @param {*} sourceRange
*/
function depDrop_(range, sourceRange) {
var rule = SpreadsheetApp.newDataValidation().requireValueInRange(sourceRange, true).build();
range.setDataValidation(rule);
}
@mechbullgt
mechbullgt / gist:eab87b2267a40bdb63fdd305ce06e814
Last active March 11, 2019 20:42
Prometheus for Monitoring
Source: https://dzone.com/articles/monitoring-with-prometheus
Components:
1) Prometheus Server
2) Target (Linux Machine) - Exporter (Node Exporter)
3) Visualization Layer (Grafana)
Prometheus has a main central component called Prometheus Server.
As a monitoring service, Prometheus servers monitor a particular thing.
That thing could be anything: it could be a an entire Linux server, a stand-alone Apache server, a single process, a database service or some other system unit that you want to monitor.
@mechbullgt
mechbullgt / Add Git to Local Project
Created March 19, 2019 19:18
Add Remote Git Url to local project
Happy Path!
Create a new repository on Github.
Open terminal and change the working directory to the local project.
$ git init
$ git add . (To stage all the files in the local project directory)
$ git commit -m "First Commit" (To commit the files that were staged in the local directory)
Copy the remote URL from Github project page, it would be something like, "https://github.com/mechbullgt/hello-world.git"
$ git remote add origin <add the remote url here>
$ git remote -v (To verify is the remote urls are configured properly for the push & fetch)
@mechbullgt
mechbullgt / gist:f84c08dacc82d32f7fcba7143eb70812
Created May 6, 2019 06:32
Make First Commit as only commit, to remove old commits from a boilerplate clone.
Step 1: remove all history (Make sure you have backup, this cannot be reverted)
cat .git/config # note <github-uri>
rm -rf .git
Step 2: reconstruct the Git repo with only the current content
git init
git add .
git commit -m "Initial commit"
@mechbullgt
mechbullgt / allAboutConsoles.txt
Created May 7, 2019 08:21
More than just Console.log();
1) Show me the logs in the console.
console.log();
2) To avoid clutter
foo ={};
bar ={};
console.log({foo, bar});
3) Warn me, on console with the message
console.warn("Get the hell out");
@mechbullgt
mechbullgt / mongodb-mongoose.js
Created May 9, 2019 07:26
Mongoose is a Obect Document Mapper (ODM) for Nodejs. (Connecting to MongoDB via Mongoose)
//require mongoose module
var mongoose = require('mongoose');
//require chalk module to give colors to console text
var chalk = require('chalk');
//require database URL from properties file
var dbURL = require('./property').db;
var connected = chalk.bold.cyan;
@mechbullgt
mechbullgt / bash_tricks.txt
Last active June 9, 2019 06:21
Reduce Bash Prompt Directory Size
Reduce Bash prompt size by entering: PS1='\u:\W\$ '
@mechbullgt
mechbullgt / gist:ff54452035d629d12387c0188df505d8
Last active May 6, 2020 21:20
Privacy Policy for Android App Namaz Basics v1.0.0
Namaz Basics is a simple application to share valuable information to the first time learners and a quick reference for everyone else.
Namaz Basics, doesn't collect any personal data or uses any cookies to collection personally identifiable information about our users.