Skip to content

Instantly share code, notes, and snippets.

@pala
Last active December 19, 2015 00:28
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 pala/5868541 to your computer and use it in GitHub Desktop.
Save pala/5868541 to your computer and use it in GitHub Desktop.
Coursera: Startup Engineering
#!/usr/bin/env node
var checkprime = function(smallerPrimes, number) {
isprime = 1;
for (var i = 0; i < smallerPrimes.length; i++) {
if (number % smallerPrimes[i] == 0) {
isprime = 0;
break;
}
}
return isprime;
}
var firstkprime = function(k) {
var i = 1;
var arr = [2];
for (i = 1; i < k; i++) {
var numbertocheck = arr[arr.length - 1];
var foundprime = 0;
while (foundprime == 0) {
numbertocheck += 1;
if (checkprime(arr, numbertocheck)) {
arr.push(numbertocheck);
foundprime = 1;
}
}
}
return arr;
};
var fmt = function(arr) {
return arr.join(",");
};
var k = 100;
var fs = require('fs');
var outfile = "prime.txt";
var out = fmt(firstkprime(k)) + "\n";
fs.writeFileSync(outfile, out);
console.log("Script: " + __filename + "\nWrote: " + out + "To: " + outfile);

##Sign up June 25, 2013

##HW1 Quiz: Github, Heroku, and AWS Date: June 25, 2013

  1. Sign up Github

    https://gist.github.com/pala

  2. Deploy a heroku app

    http://secure-harbor-3442.herokuapp.com/

  3. Setup an ec2 instance

    done

##Lecture 3: Linux and Server-Side Javascript ###The Cloud

image

  1. Infrastructure as a service (IaaS): AWS, Linode, Rackspace …
  2. Platform as a service (PaaS): Heroku, GAE ...
  3. Software as a service (SaaS): Google Apps ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment