Skip to content

Instantly share code, notes, and snippets.

@amingilani
Created November 27, 2015 12:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amingilani/c4f1baeedb7319255c1c to your computer and use it in GitHub Desktop.
Save amingilani/c4f1baeedb7319255c1c to your computer and use it in GitHub Desktop.
gilani@debris  ~/Sandbox/passphrase   v1  node
> 26+26+10
62
> Math.pow(62,4)
14776336
>
(^C again to quit)
>
gilani@debris  ~/Sandbox/passphrase   v1  isup
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=48 time=339 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=48 time=337 ms
^C
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 337.966/338.702/339.438/0.736 ms
gilani@debris  ~/Sandbox/passphrase   v1  node
> Math.log(2)
0.6931471805599453
> Math.log(1)
0
> var log = Math.log();
undefined
> log( Math.pow(62,2) ) / log(2)
TypeError: log is not a function
at repl:1:1
at REPLServer.defaultEval (repl.js:164:27)
at bound (domain.js:280:14)
at REPLServer.runBound [as eval] (domain.js:293:12)
at REPLServer.<anonymous> (repl.js:393:12)
at emitOne (events.js:82:20)
at REPLServer.emit (events.js:169:7)
at REPLServer.Interface._onLine (readline.js:210:10)
at REPLServer.Interface._line (readline.js:549:8)
at REPLServer.Interface._ttyWrite (readline.js:826:14)
> log( Math.pow(62,2) ) / log(2)
TypeError: log is not a function
at repl:1:1
at REPLServer.defaultEval (repl.js:164:27)
at bound (domain.js:280:14)
at REPLServer.runBound [as eval] (domain.js:293:12)
at REPLServer.<anonymous> (repl.js:393:12)
at emitOne (events.js:82:20)
at REPLServer.emit (events.js:169:7)
at REPLServer.Interface._onLine (readline.js:210:10)
at REPLServer.Interface._line (readline.js:549:8)
at REPLServer.Interface._ttyWrite (readline.js:826:14)
> var log = Math.log;
undefined
> log( Math.pow(62,2) ) / log(2)
11.908392620773752
> isup
ReferenceError: isup is not defined
at repl:1:1
at REPLServer.defaultEval (repl.js:164:27)
at bound (domain.js:280:14)
at REPLServer.runBound [as eval] (domain.js:293:12)
at REPLServer.<anonymous> (repl.js:393:12)
at emitOne (events.js:82:20)
at REPLServer.emit (events.js:169:7)
at REPLServer.Interface._onLine (readline.js:210:10)
at REPLServer.Interface._line (readline.js:549:8)
at REPLServer.Interface._ttyWrite (readline.js:826:14)
> var hRate = 6 * Math.pow(10,18);
undefined
> hRate
6000000000000000000
> Math.pow(62,4) / hRate
2.462722666666667e-12
> Math.pow(62,4) / hRate
2.462722666666667e-12
> Math.pow(62,4)
14776336
> Math.pow(62,4) / hRate
2.462722666666667e-12
> var b2n = function(bits) { return Math.pow(2, bits) };
undefined
> b2n(18)
262144
> var s2c = function(bits) { return b2n(bits) / hRate };
undefined
> s2c(18)
4.369066666666667e-14
> s2c(48)
0.00004691249611844267
> s2c(48)
0.00004691249611844267
> s2c(49)
0.00009382499223688534
> s2c(48)
0.00004691249611844267
> s2c(50)
0.00018764998447377067
> s2c(60)
0.19215358410114117
> s2c(80)
201487.6366024382
> var s2d = function (seconds) { return seconds/60/60/24}
undefined
> s2c(80)
201487.6366024382
> s2c(80)
201487.6366024382
> s2d(s2c(80))
2.3320328310467384
> s2d(s2c(100))
2445313.657847665
> s2d(s2c(81))
4.664065662093477
> s2d(s2c(82))
9.328131324186954
> s2d(s2c(100))
2445313.657847665
> var s2y = function (sec) { return s2d(sec)/365; );
...
> var s2y = function (sec) { return s2d(sec)/365;};
undefined
> s2y(s2c(100))
6699.489473555246
> s2y(s2c(128))
1798380511801.0024
> s2y(s2c(4096))
Infinity
> typeof s2y(s2c(4096))
'number'
> typeof s2y(s2c(132))
'number'
> s2y(s2c(132))
28774088188816.04
> Math.pow(2048,12)
5.444517870735016e+39
> log(Math.pow(2048,12)) / log(2)
132
> s2y(s2c(132))
28774088188816.04
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment