Skip to content

Instantly share code, notes, and snippets.

View nodesocket's full-sized avatar

Justin Keller nodesocket

View GitHub Profile
app.post('/oauth/signin', [
oauthLogger,
jsonParser,
function(req, res) {
if(!req.body) {
res.status(400).send({
error: {
status_code: 400,
status: 'Bad Request',
message: 'Missing required body'

Commando.io. A simpler way to manage servers online. Commando.io; your first DevOps hire!

Install Notes

  • API token secret key - A valid API token secret key. You may create API tokens on the settings page in the Commando.io web interface.
  • Account alias - Your account alias is simply the subdomain that you access Commando.io with. For example the account alias of https://foo.commando.io is foo.
  • Recipe - The recipe you wish to execute. You may find recipe ids in the in the Commando.io web interface.
  • Server - A single server id. You may find server ids in the modal popup when clicking a server in the Commando.io web interface.
  • Groups - A list of group ids seperated by commas. You may find group ids in the modal popup when clicking a group in the Commando.io web interface.
BASE_PATH="/var/www/vhosts/my.photocloudapp.com"
REPO_PATH="/var/www/vhosts/my.photocloudapp.com/public"
GIT_URL="https://github.com/photocloud/webapp.git"
if [ -d "$REPO_PATH" ]; then
cd $REPO_PATH
git pull --quiet
echo "git pull successfully ran";
else
cd $BASE_PATH
BASE_PATH="/var/www/vhosts/my.photocloudapp.com"
REPO_PATH="/var/www/vhosts/my.photocloudapp.com/webapp"
GIT_URL="https://github.com/photocloud/webapp.git"
if [ -d "$REPO_PATH" ]; then
cd $REPO_PATH
git pull --quiet
echo "git pull successfully ran";
else
cd $BASE_PATH
@nodesocket
nodesocket / gist:6ac8ea0c768638ab9f58
Created May 31, 2015 02:24
Globally install io.js on Raspberry Pi (Raspbian)
cd ~
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | bash
nvm install iojs
nvm use iojs
n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; sudo cp -r $n/{bin,lib,share} /usr/local
@nodesocket
nodesocket / gist:1215691
Created September 14, 2011 02:03
Public Keys
ssh-dss AAAAB3NzaC1kc3MAAACBAOLsyYuyI0/3/UjajY8ljdgkAV2k9jZxjlVGWvHa9afMuO7DqsOcu0o4e5D9TPScsO5XrgTrmcXHkOtM54fOPdXSzonWOXUIn1XEumdHDlv9YRZTCW/A9qajhPR67y+92su9AqeGXI0/q3BXZsZcC1nr1NjgSiz++r+YZFVWfQsNAAAAFQCYBf0KXVLfYUE6cOTbWnBWn5Py9QAAAIEA3WAkAwhR7fhwWpxuwxNnsB8NXwsEs2NWiOaiMu3dmDWyqGRjfOYUchoLelBMpv4oLTZuaGW4/DCWfdh6pgrxs39MXf+FdTir8KeHIIoXEdcXpWqnuyNBdXn5XNY54vc1eMkbm4q3D1i3+IMhNAURasdvFRoDzgH9s68Ik3P5HrMAAACAab+CiT010wXMzv+6v+oWcRWbxhGou/ND+K2QGU1kAW+KuUGmhOgB6XPka7iEsIeA/+Ojh+OiNedFZlJAZq1jarew106YCOrUlbtDk7pAAUJQhIhKFhpNE0UhLRBWOF9LpjDwWu55dlrfLURE32TuMx/NsazWVypbzJqy48d2sg8= justin@mbpro
@nodesocket
nodesocket / hack-with-set-timeout.js
Created September 15, 2011 21:41
How To Refactor This, Without Using SetTimeout
child.on("start", function(forever) {
//A bit of a hack, but we delay before calling the callback because we want to see if error or exit events are fired.
setTimeout(function() {
typeof this.callback === "function" ? this.callback.call() : null;
}.bind({ callback: this.callback }), 500);
}.bind({ callback: callback }));
child.on("exit", function(forever) {
typeof this.callback === "function" ? this.callback.call() : null;
}.bind({ callback: callback }));
diff --git a/lib/net.js b/lib/net.js
index 4af00b4..9565b38 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -350,8 +350,9 @@ Socket.prototype.write = function(data /* [encoding], [fd], [cb] */) {
this._writeQueueCallbacks[last] = cb;
} else {
// awful
+ var original = this._writeQueueCallbacks[last];
this._writeQueueCallbacks[last] = function() {
//Socket not connected
else {
//Not already trying to connect, create a new socket
if(!logify.connecting) {
//Create the socket
logify.connecting = true;
logify.connect();
}
//Write to temporary storage array
//Socket not connected
else {
//Not already trying to connect, create a new socket
if(!logify.connecting) {
//Create the socket
logify.connecting = true;
logify.connect();
}
//Write to temporary storage array