Skip to content

Instantly share code, notes, and snippets.

View questsin's full-sized avatar

Nicholas Manolakos questsin

View GitHub Profile
//namespace to avoid collitions between src
var AppSpace = {};
AppSpace.createUUID = function() {
// http://www.ietf.org/rfc/rfc4122.txt
var s = [];
var hexDigits = "0123456789abcdef";
for (var i = 0; i < 36; i++) {
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
}
var express = require('express');
//cli
var fs = require('fs');
var stream = fs.createReadStream('my-file.txt');
stream.on('data', function(chunk){
// do something with part of the file
});
stream.on('end', function(chunk){
<!DOCTYPE html>
<html>
<head>
<title>sample html</title>
<style type="">
label(
display:inline-block;
width:150px;
)
</style>
var AWS = require('aws-sdk');
var firehose = new AWS.Firehose();
exports.handler = function(event, context) {
var params = {
DeliveryStreamName: <STRING>,
Record: {
Data: decodeURIComponent(event)
}
};
var FicsClient = require("fics");
var socket = (new FicsClient()).getStream();
process.stdin.pipe(socket);
socket.pipe(process.stdout);
socket.on("close", process.exit);
#!/bin/sh
##########################
# fetch_pres_log.sh -
# script to download the access_logs from
# the rPVR webserver.
##########################
# SSH Configuration Note
# -------------------------------------------------------------------
# The host alias, username and SSH key identity file are all configured
<!DOCTYPE html>
<html>
<head>
<title>AWS SDK for JavaScript - Sample Application</title>
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.1.12.min.js"></script>
</head>
<body>
<input type="file" id="file-chooser" />
var express = require('express')
var app = express()
app.get('/', function (req, res) {
res.send('Hello World!')
})
var server = app.listen(3000, function () {
var host = server.address().address
// primitives
var a = 5;
var b = a;
b = 6;
//a; // will be 5
//b; // will be 6
// complex
var a = ['hello', 'world'];
var b = a;
var CryptoJS = require("crypto-js");
console.log(CryptoJS.HmacSHA1("Message", "Key"));
// Encrypt
var ciphertext = CryptoJS.AES.encrypt('my message', 'secret key 123');
// Decrypt
var bytes = CryptoJS.AES.decrypt(ciphertext.toString(), 'secret key 123');