Thursday, December 27, 2018

Linux: Prevent SSH timeout

https://bjornjohansen.no/ssh-timeout

In ~/.ssh/config add the following line:

     ServerAliveInterval 30

This will send a “null packet” every 30 seconds on your SSH connections to keep them alive.




Monday, December 17, 2018

ES6 - list of some of the new things

Some of the new things in ES6: 
destructuring, default parameter values, symbols, concise methods, computed properties, arrow functions, block scoping, promises, generators, iterators, modules, proxies, weakmaps, etc

Friday, December 14, 2018

Javascript - this, bind, call

// this , bind, call

var msg = "global";

function f(x){
  console.log(this.msg + "," + x);
}

var obj1 = {
  msg: "obj1",
  f: f
}

var obj2 = {
  msg: "obj2"
}

f(10);
obj1.f(10);
f.call(obj2, 10);

// f.call(window, 10);
// f.call(obj1, 10);
// f.call(obj2, 10);

// f.bind(obj1)(10)
// f.bind(obj2)(10)
// f.bind(window)(10)

Sunday, December 9, 2018

Config in Elixir projects

Excerpt from Elixir Cookbook -
The configuration from the imported files will override any existing configuration (with the same key) in the config.exs file. In fact, Configuration values are merged recursively. See the example at https://github.com/alco/mix-config-example.
To access configuration values, we use Application.get_env(:app, :key)

Friday, November 9, 2018

MySQL Slow Queries

SELECT * FROM `mysql`.slow_log ORDER BY query_time DESC;

Wednesday, November 7, 2018

Database related - Composite Indexes

How do composite indexes work - https://stackoverflow.com/questions/795031/how-do-composite-indexes-work


https://stackoverflow.com/a/795068

Composite indexes work just like regular indexes, except they have multi-values keys.
If you define an index on the fields (a,b,c) , the records are sorted first on a, then b, then c.
Example:
| A | B | C |
-------------
| 1 | 2 | 3 |
| 1 | 4 | 2 |
| 1 | 4 | 4 |
| 2 | 3 | 5 |
| 2 | 4 | 4 |
| 2 | 4 | 5 |
  • 12 Please note also that indexes are stored as Btree, so an (a,b,c) index will help on a search on (a) and on (a, b),
     but not on other searches like (b) or (b,c). – aexl Apr 30 '16 at 17:53




"MySQL can use multiple-column indexes for queries that test all the columns in the index, or queries that test just the first column, the first two columns, the first three columns, and so on. If you specify the columns in the right order in the index definition, a single composite index can speed up several kinds of queries on the same table." - Multiple-Column Indexes – AlikElzin-kilaka Sep 9 at 4:46


https://stackoverflow.com/questions/2349817/two-single-column-indexes-vs-one-two-column-index-in-mysql
https://stackoverflow.com/questions/179085/multiple-indexes-vs-multi-column-indexes?rq=1

Friday, October 26, 2018

labex.io - online courses with virtual environments

https://labex.io/courses

Has courses for Alibaba Cloud also.

up - tool for writing Linux pipes

https://github.com/akavel/up

up is the Ultimate Plumber, a tool for writing Linux pipes in a terminal-based UI interactively, with instant live preview of command results.
The main goal of the Ultimate Plumber is to help interactively and incrementally explore textual data in Linux, by making it easier to quickly build complex pipelines, thanks to a fast feedback loop. This is achieved by boosting any typical Linux text-processing utils such as grepsortcutpasteawkwcperl, etc., etc., by providing a quick,interactive, scrollable preview of their results.

IronDB, EverCookie

Internationalization - React vs Angular

Saturday, October 13, 2018

Tuesday, October 2, 2018

react-native-turbolinks

Mongo - exporting and importing a single database

On Source Machine
-------------------------
mongo
> show dbs
> exit

mongodump -d abc_xyz_development

(Above command will create a dump/abc_xyz_development folder and put all the files inside it. This folder will need to be zipped and sent to whoever wants to import the database)

On Target Machine
-------------------------

Drop existing database
mongo

> show dbs

> use abc_xyz_development;
> db.dropDatabase();
> exit

Restore from Dump folder:
Command:
  mongorestore -d
E.g.
  mongorestore -d abc_xyz_development ~/abc_xyz_development

Wednesday, September 26, 2018

Followers

Blog Archive