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
#!/bin/bash | |
# | |
# This script is triggered by crontab every 5 minutes. | |
# Logs to /var/log/ui-server/<host>-rails_check.log. | |
log_dir=/var/log/my_rails_app | |
mkdir -p $log_dir | |
log_file=$log_dir/$(hostname)-rails_check.log | |
# Limits in MB |
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
import com.mongodb.BasicDBObject; | |
import com.mongodb.DB; | |
import com.mongodb.MongoClient; | |
import java.net.UnknownHostException; | |
public class powerOf2Sizes { | |
public static void main(String[] args) throws UnknownHostException { | |
MongoClient mongoClient = new MongoClient(); | |
DB db = mongoClient.getDB("myDB"); |
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
// Note: Ensure there's an existing index, e.g.: | |
// db.assets.ensureIndex({ assetExpiration: 1 }) | |
// Since remove() doesn't support limit(), we can't do the following directly: | |
// db.assets.remove({ assetExpiration: { $lt: newDate() } }).limit(batchSize) | |
// So we do the following instead: | |
batchSize = 100 | |
removeMe = [] |
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
function makeEmail() { | |
var strValues="abcdefghijklmnopqrstuvwxyz"; | |
var strEmail = ""; | |
var strTmp; | |
for (var i=0;i<10;i++) { | |
strTmp = strValues.charAt(Math.round(strValues.length*Math.random())); | |
strEmail = strEmail + strTmp; | |
} | |
strTmp = ""; | |
strEmail = strEmail + "@"; |