Skip to content

Instantly share code, notes, and snippets.

var http = require('http');
function processRequest(res, num, startTime) {
if (!startTime) startTime = new Date();
if (num === undefined) {
return process.nextTick(function() {
processRequest(res, 0);
});
}
@jdolitsky
jdolitsky / api.js
Created March 13, 2013 05:50 — forked from fwielstra/api.js
/* The API controller
Exports 3 methods:
* post - Creates a new thread
* list - Returns a list of threads
* show - Displays a thread and its posts
*/
var Thread = require('../models/thread.js');
var Post = require('../models/post.js');
@jdolitsky
jdolitsky / installation etc.
Last active December 21, 2015 10:09
steps to get your computer setup for node.js development
*Mac only
Sublime Text 2
------------------------
1.) go to http://www.sublimetext.com/2
2.) download link for your OS
Xcode*
------------------------
1.) go to App Store
@jdolitsky
jdolitsky / clone repo
Last active December 21, 2015 10:09
checkout first section of node course and install packages
cd ~
git clone [email protected]:jdolitsky/nodejscourse.git -b step1
cd nodejscourse
sudo npm install
@jdolitsky
jdolitsky / Vagrantfile
Created March 13, 2014 08:29
Vagrant, Docker, & Jenkins
# Creates a Jenkins environment at http://localhost:3000
VAGRANTFILE_API_VERSION = 2
GUEST_JENKINS_PORT = 8080
HOST_JENKINS_PORT = 3000
JENKINS_DOCKER_IMAGE = "aespinosa/jenkins"
VM_BOX_NAME = "precise64"
VM_BOX_URL = "http://files.vagrantup.com/precise64.box"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
[root@host ~]# irb
irb(main):001:0> require "/usr/lib64/ruby/site_ruby/1.8/powerpc64-linux/shadow.so" #varies by platform - check 'rpm -ql ruby-shadow' for real location.
=> true
irb(main):004:0> Shadow::Passwd.getspent()
=> #<struct Struct::PasswdEntry sp_namp="root", sp_pwdp="$1$s9SM/aIM$ATv5Gcjkd2b/G/rkddVTq0", sp_lstchg=15095, sp_min=0, sp_max=99999, sp_warn=7, sp_inact=-1, sp_expire=-1, sp_flag=-1>
(execute getspent() repeatedly, should give a new user entry each time.
irb(main):009:0> Shadow::Passwd.setspent()
=> nil
[program:hello]
command = python /path/hello.py --port=80%(process_num)02d
process_name = %(program_name)s-80%(process_num)02d
stdout_logfile = /path/hello-80%(process_num)02d.log
numprocs = 5
numprocs_start = 1
; tornado run port list:
; 127.0.0.1:8001 (first)
; 127.0.0.1:8002
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
@jdolitsky
jdolitsky / README.md
Created November 11, 2015 15:20 — forked from dnozay/_Jenkins+Script+Console.md
jenkins groovy scripts collection.
version: '1.0'
steps:
create_chart_package:
image: codefresh/plugin-helm:2.7.2
commands:
# Repo name may not necessarily match the chart name, but the "helm package"
# command requires the current directory and the chart name to match. So we
# extract the chart name from Chart.yaml, then create a working directory for