Monday, December 31, 2018
Sunday, December 30, 2018
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.
Wednesday, December 26, 2018
Friday, December 21, 2018
Thursday, December 20, 2018
Wednesday, December 19, 2018
Monday, December 17, 2018
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)
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)
Thursday, December 13, 2018
Wednesday, December 12, 2018
Tuesday, December 11, 2018
Monday, December 10, 2018
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, December 7, 2018
Thursday, December 6, 2018
Tuesday, December 4, 2018
Saturday, December 1, 2018
AWS Cloud Development Kit
AWS re:Invent 2018: Infrastructure Is Code with the AWS Cloud Development Kit (DEV372)
https://www.reddit.com/r/programming/comments/a22fay/aws_infrastructure_as_code_using_aws_cdk/
Monday, November 26, 2018
Sunday, November 25, 2018
PostgreSQL & Homebrew
https://stackoverflow.com/questions/15301826/psql-fatal-role-postgres-does-not-exist
If you're using postgres from Homebrew, then you want
If you're using postgres from Homebrew, then you want
/usr/local/Cellar/postgresql/9.2.4/bin/createuser -s postgres (for version 9.2.4, obviously). Saturday, November 24, 2018
Thursday, November 22, 2018
Database Indexes - How to determine if an Index is required or not
https://dba.stackexchange.com/questions/56/how-to-determine-if-an-index-is-required-or-necessary
http://blog.celerity.com/how-to-design-sql-indexes
http://blog.celerity.com/how-to-design-sql-indexes
22/08/2017, 19:03:36B-Trees in databases are not binary trees, they are BALANCED trees
Tuesday, November 20, 2018
UUID related
Seems like an exercise in trying to hack something using UUID guessing -
https://medium.com/@evinsellin/communicating-through-uuid-conflicts-fe50134304dbElectron, Desktop PWAs
Medium article:
https://medium.com/dailyjs/goodbye-electron-hello-desktop-pwas-f316b8f39882
YouTube video:
https://medium.com/dailyjs/goodbye-electron-hello-desktop-pwas-f316b8f39882
YouTube video:
Sunday, November 18, 2018
Saturday, November 17, 2018
Sunday, November 11, 2018
Friday, November 9, 2018
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
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),
"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
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
Monday, November 5, 2018
Thursday, November 1, 2018
Wednesday, October 31, 2018
Monday, October 29, 2018
Sunday, October 28, 2018
Friday, October 26, 2018
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 asgrep,sort,cut,paste,awk,wc,perl, etc., etc., by providing a quick,interactive, scrollable preview of their results.
Thursday, October 25, 2018
Tuesday, October 16, 2018
Erlang 'process'
https://www.quora.com/What-is-the-difference-between-system-threads-and-process-threads-as-in-Java-threads
Excerpt:
Excerpt:
Erlang uses the term "process" because it does not expose a shared-memory multiprogramming model. Calling them "threads" would imply that they have shared memory.
Sunday, October 14, 2018
Saturday, October 13, 2018
Thursday, October 4, 2018
Tuesday, October 2, 2018
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
-------------------------
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
Saturday, September 29, 2018
Wednesday, September 26, 2018
Sunday, September 23, 2018
Friday, September 21, 2018
Thursday, September 20, 2018
Monday, September 17, 2018
Saturday, September 15, 2018
React & JSX related: using JSX without React, minimal setup for trying out React
using JSX without React:
https://itnext.io/lessons-learned-using-jsx-without-react-bbddb6c28561
Minimal React.js Without A Build Step:
https://shinglyu.github.io/web/2018/02/08/minimal-react-js-without-a-build-step-updated.html
https://itnext.io/lessons-learned-using-jsx-without-react-bbddb6c28561
Minimal React.js Without A Build Step:
https://shinglyu.github.io/web/2018/02/08/minimal-react-js-without-a-build-step-updated.html
MIPA