Skip to content

Instantly share code, notes, and snippets.

@sujeet-agrahari
sujeet-agrahari / benchmarking_profiling.md
Created November 19, 2020 11:48 — forked from vinhnglx/benchmarking_profiling.md
Difference between Benchmarking and Profiling

Concepts

Benchmarking. We take two competing pieces of code - could be as simpler as a one liner or as complex as an entire web framework. Then, we put them up against each other (iterations per second). At the end of the task, we come up with a single metric, a score. We use the score to compare the two competing options.

In Ruby, the Benchmark module provides methods to measure and report the time used to execute Ruby code. http://ruby-doc.org/stdlib-2.0.0/libdoc/benchmark/rdoc/Benchmark.html

Profiling. Profiling your program is a way to determining which methods are called and how long each method take to complete.

@sujeet-agrahari
sujeet-agrahari / benchmarking_profiling.md
Created November 19, 2020 11:48 — forked from vinhnglx/benchmarking_profiling.md
Difference between Benchmarking and Profiling

Concepts

Benchmarking. We take two competing pieces of code - could be as simpler as a one liner or as complex as an entire web framework. Then, we put them up against each other (iterations per second). At the end of the task, we come up with a single metric, a score. We use the score to compare the two competing options.

In Ruby, the Benchmark module provides methods to measure and report the time used to execute Ruby code. http://ruby-doc.org/stdlib-2.0.0/libdoc/benchmark/rdoc/Benchmark.html

Profiling. Profiling your program is a way to determining which methods are called and how long each method take to complete.

/**
* Created by erwincdl on 03/02/16.
*/
var winston = require('winston');
var getTimestamp = () => {
return Date.now();
};
var logger = new winston.Logger({
@sujeet-agrahari
sujeet-agrahari / dump
Created November 17, 2020 02:48 — forked from JasaPC/dump
Mysql dump #mysql
#If you are connected to the server
mysqldump -u user -p database > output.sql
#Remote dump
ssh [email protected] "mysqldump -u admin -p drupal | gzip -9" > chelos-prod.sql.gz
@sujeet-agrahari
sujeet-agrahari / MySQL-Guide.txt
Created November 17, 2020 02:48 — forked from i-stos/MySQL-Guide.txt
MySQL: Basic MySQL Guide
==========================================================================================================
MySQL Guide - Basics
==========================================================================================================
Connect/Disconnect from MySQL Server
----------------------------------------------------------------------------------------------------------
:~ sudo mysqld_safe //Turns on MySQL server
:~ mysql -h host -u root -p //Connects to MySQL server: "no need to specify host on local"
mysql> quit; //Disconnects from MySQL
:~ mysqladmin -u root -p shutdown //Shuts down MySQL server
----------------------------------------------------------------------------------------------------------
@sujeet-agrahari
sujeet-agrahari / 6_privileges.sql
Created November 17, 2020 02:46 — forked from SolemnJoker/6_privileges.sql
[mysql privileges] #mysql
use mysql;
select host, user from user;
grant all on uic.* to root@'%' identified by '123456' with grant option;
grant all on falcon_portal.* to root@'%' identified by '123456' with grant option;
grant all on dashboard.* to root@'%' identified by '123456' with grant option;
grant all on graph.* to root@'%' identified by '123456' with grant option;
grant all on alarms.* to root@'%' identified by '123456' with grant option;
flush privileges;
@sujeet-agrahari
sujeet-agrahari / mysql_commands.sh
Last active November 17, 2020 02:45 — forked from kudosqujo/mysql_commands.sh
[MySQL] commands #mysql
# Create a new db
mysqladmin -u root -p create some_db.test
# Create a dump
mysqldump -u some_user -p some_pswd > some_db.test.dump.sql
# Populate a db using a dump
mysql -u root -p some_db.test < some_db.test.dump.sql
@sujeet-agrahari
sujeet-agrahari / mysql_cheetsheet.md
Created November 17, 2020 02:45 — forked from andresaquino/mysql_cheetsheet.md
[MySQL Cheetsheet] #mysql #mariadb

Exporting a Compressed MySQL Dump

mysqldump -u {user} -p {database} | gzip > {database}.sql.gz

Importing a Compressed MySQL Dump

gzip -dc < {database}.sql.gz | mysql -u {user} -p {database}
@sujeet-agrahari
sujeet-agrahari / mysql-docker.sh
Created November 17, 2020 02:39 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@sujeet-agrahari
sujeet-agrahari / xampp_php7_xdebug.md
Created October 8, 2020 02:39 — forked from odan/xampp_php7_xdebug.md
Installing Xdebug for XAMPP