TODO: Write a project description
TODO: Describe the installation process
var mongoObjectId = function () { | |
var timestamp = (new Date().getTime() / 1000 | 0).toString(16); | |
return timestamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, function() { | |
return (Math.random() * 16 | 0).toString(16); | |
}).toLowerCase(); | |
}; |
#!/usr/bin/env node | |
var fs = require('fs'); | |
var outfile = "primes.txt"; | |
var count = 0; | |
var maxCount = 100; | |
var primes = []; | |
var i = 2; |
/* | |
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp | |
server, but for some reason omit a client connecting to it. I added an | |
example at the bottom. | |
Save the following server in example.js: | |
*/ | |
var net = require('net'); |
# delete local tag '12345' | |
git tag -d 12345 | |
# delete remote tag '12345' (eg, GitHub version too) | |
git push origin :refs/tags/12345 | |
# alternative approach | |
git push --delete origin tagName | |
git tag -d tagName |
import requests | |
uf = False # Unfollow all (currently followed) users? | |
f = True # Follow all (currently unfollowed) users? | |
def url(path, page=1, auth=""): | |
return "https://api.github.com" + path + "?page=" + str(page) + "&access_token=" + auth | |
def unfollow(user): | |
requests.delete(url("/user/following/" + user["login"], 1, auth)) |
List some crypto libraries for JavaScript out there. Might be a bit out dated. Scroll to the bottom.
http://www.w3.org/TR/WebCryptoAPI/
This specification describes a JavaScript API for performing basic cryptographic operations in web applications, such as hashing, signature generation and verification, and encryption and decryption. Additionally, it describes an API for applications to generate and/or manage the keying material necessary to perform these operations. Uses for this API range from user or service authentication, document or code signing, and the confidentiality and integrity of communications.
When hosting our web applications, we often have one public IP
address (i.e., an IP address visible to the outside world)
using which we want to host multiple web apps. For example, one
may wants to host three different web apps respectively for
example1.com
, example2.com
, and example1.com/images
on
the same machine using a single IP address.
How can we do that? Well, the good news is Internet browsers
#!/bin/bash | |
MONGO_DATABASE="your_db_name" | |
APP_NAME="your_app_name" | |
MONGO_HOST="127.0.0.1" | |
MONGO_PORT="27017" | |
TIMESTAMP=`date +%F-%H%M` | |
MONGODUMP_PATH="/usr/bin/mongodump" | |
BACKUPS_DIR="/home/username/backups/$APP_NAME" |
With Node you can write very fast JavaScript programs serverside. It's pretty easy to install Node, code your program, and run it. But > how do you make it run nicely in the background like a true server?
/etc/init/
$ sudo vim yourapp.conf
$ sudo start yourapp
$ sudo stop yourapp