This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path'), | |
optimist = require('optimist'), | |
spawn = require('child_process').spawn, | |
fs = require('fs'), | |
Clip = require('../kindle-my-clippings'), | |
deploySettings = require('../deploy-settings'), | |
options = require('../options'); | |
var clip = new Clip(options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var writeData = JSON.stringify(data) + '@@||@@'; | |
fs.appendFile('amq.log', writeData, function (err) { | |
// console.log(err); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"appenders": [ | |
{ | |
"type": "file", | |
"filename": "serverLog.log" , | |
"category": "simplelog", | |
"backups" : 2, | |
"maxLogSize": 20480, | |
"description": "Example log." | |
}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Remove leading and trailing whitespace | |
// Requires jQuery | |
var str = " a b c d e f g "; | |
var newStr = $.trim(str); | |
// "a b c d e f g" | |
// Remove leading and trailing whitespace | |
// JavaScript RegEx | |
var str = " a b c d e f g "; | |
var newStr = str.replace(/(^\s+|\s+$)/g,''); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* jQuery utility for centering a div on the screen | |
* | |
* @static | |
* @method $.centerBox | |
*/ | |
$.fn.centerBox = function () { | |
var t = this; | |
t.css("top", Math.max(0, (($(window).height() - this.outerHeight()) / 2) + $(window).scrollTop()) + "px"); | |
t.css("left", Math.max(0, (($(window).width() - this.outerWidth()) / 2) + $(window).scrollLeft()) + "px"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Transform = require('stream').Transform; | |
/// Server: | |
var server = require('net').createServer(); | |
function onConnection(socket) { | |
/// Create the transform stream: | |
var uppercase = new Transform({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From: http://codewinds.com/blog/2013-08-04-nodejs-readable-streams.html | |
//Simple example of reading a file and echoing it to stdout: | |
var fs = require('fs'); | |
var readStream = fs.createReadStream('../sources/bible.txt'); | |
readStream.pipe(process.stdout); | |
// ==================================================================================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module.exports = function(grunt) { | |
grunt.initConfig({ | |
jshint: { | |
options: { | |
jshintrc: '.jshintrc' | |
}, | |
all: [ | |
'Gruntfile.js', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat ~/.ssh/id_rsa.pub | ssh usert@host "cat >> ~/.ssh/authorized_keys" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#Get current date | |
NOW="$(date +'%d-%m-%Y_%H-%M')" | |
# Settings: | |
# Path to a temporary directory | |
DIR=/root/mongodb_dump/ |