In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:
- Separate big codebases into multiple repositories.
function encrypt(text){ | |
var cipher = crypto.createCipher('aes-256-cbc','d6F3Efeq') | |
var crypted = cipher.update(text,'utf8','hex') | |
crypted += cipher.final('hex'); | |
return crypted; | |
} | |
function decrypt(text){ | |
var decipher = crypto.createDecipher('aes-256-cbc','d6F3Efeq') | |
var dec = decipher.update(text,'hex','utf8') |
/** | |
* Process an array of data synchronously. | |
* | |
* @param data An array of data. | |
* @param processData A function that processes an item of data. | |
* Signature: function(item, i, callback), where {@code item} is the i'th item, | |
* {@code i} is the loop index value and {@code calback} is the | |
* parameterless function to call on completion of processing an item. | |
*/ | |
function doSynchronousLoop(data, processData, done) { |
/* | |
This script, when used with Google Apps Scripts, will delete 400 emails and | |
can be triggered to run every few minutes without user interaction enabling you | |
to bulk delete email in Gmail without getting the #793 error from Gmail. | |
Google returns a maximum of 500 email threads in a single API call. | |
This script fetches 400 threads in case 500 threads is causing timeouts | |
Configure the search query in the code below to match the type of emails | |
you want to delete |
var AWS = require('aws-sdk'), | |
fs = require('fs'); | |
// http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html#Credentials_from_Disk | |
AWS.config.loadFromPath('./aws-config.json'); | |
// assume you already have the S3 Bucket created, and it is called ierg4210-shopxx-photos | |
var photoBucket = new AWS.S3({params: {Bucket: 'ierg4210-shopxx-photos'}}); | |
function uploadToS3(file, destFileName, callback) { |
[root@dev-etl apache-cassandra-2.2.3]# cd bin/ | |
[root@dev-etl bin]# ./cqlsh cassandra1.kafkacluster100.com -u dwhuser -p 'password' | |
Connection error: ('Unable to connect to any servers', {'cassandra1.kafkacluster100.com': ProtocolError("cql_version '3.3.1' is not supported by remote (w/ native protocol). Supported versions: [u'3.3.0']",)}) | |
[root@dev-etl bin]# ./cqlsh cassandra1.kafkacluster100.com -u dwhuser -p 'password' --cqlversion=3.3.0 | |
Connected to kafkacluster100 at cassandra1.kafkacluster100.com:9042. | |
[cqlsh 5.0.1 | Cassandra 2.2.1 | CQL spec 3.3.0 | Native protocol v4] | |
Use HELP for help. | |
dwhuser@cqlsh> |
/** | |
* Greedy Algorithm (maximum daily profit from stock sale) - "let me see what my options are, first..." | |
* | |
* Overview: | |
* --------- | |
* By using Greedy Algorithms we can pass over the data once (O(n) time), storing values we find to be optimal, per our criteria, by | |
* comparing them to current values. We have to go over the entire set to do this, but we only have to do it once - yay! | |
* | |
* From Wikipedia: "A greedy algorithm is an algorithm that follows the problem solving heuristic of making the locally optimal | |
* choice at each stage with the hope of finding a global optimum." |
/** | |
* DowngradeRetryPolicy - This module is used to retry the READ / WRITE operation | |
* by downgrading the value of consistency to minimum value. | |
* @constructor | |
*/ | |
function DowngradeRetryPolicy() { | |
} | |
// Inherit the retry policy | |
util.inherits(DowngradeRetryPolicy, RetryPolicy); |