This file contains hidden or 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
| db.GroovyScriptResult.find({database: {$ne:null}}).forEach( | |
| function (e) { | |
| db.GroovyScriptResult.update({_id: e._id}, {$set: {database: e.database.toLowerCase() } }) | |
| } | |
| ) |
This file contains hidden or 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
| printjson(db.GroovyScriptResult.findOne({name : "[%script%]", version : "[%version%]", database : "[%database%]", stackTrace:null})) |
This file contains hidden or 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 static org.springframework.ldap.query.LdapQueryBuilder.query; | |
| import org.springframework.ldap.core.LdapTemplate; | |
| import org.springframework.ldap.AuthenticationException; | |
| public class Example { | |
| @Autowired | |
| LdapTemplate ldapTemplate; | |
| public boolean authenticate(String uid, String credentials) { |
This file contains hidden or 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.gmongo.GMongo | |
| def gmongo = new GMongo('localhost:27017') | |
| def db = gmongo.getDB('nucleus') | |
| db.GroovyScriptResult.find([name: ~/Finance/, version: 'trunk', database: [ $ne:'opsd' ]]).each { | |
| println it | |
| } |
This file contains hidden or 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
| db.scores.update({}, {$set:{score:77}}, {multi:true}); |
This file contains hidden or 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
| db.catalog.find({price:{$gt:10000}, "reviews.rating":{$gte:5}}) |
This file contains hidden or 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 http = require("http"), | |
| url = require("url"), | |
| path = require("path"), | |
| fs = require("fs") | |
| port = process.argv[2] || 8888; | |
| http.createServer(function(request, response) { | |
| var uri = url.parse(request.url).pathname | |
| , filename = path.join(process.cwd() + "/public_html", uri); |
This file contains hidden or 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
| const FEED_ID = "YOUR_FEED_ID"; | |
| const API_KEY = "YOUR_API_KEY"; | |
| // Accept CSV from device, then format request to and accept response from xively.com | |
| device.on("data", function(feedCSV) { | |
| server.log(feedCSV); | |
| local xively_url = "https://api.xively.com/v2/feeds/" + FEED_ID + ".csv"; | |
| local request = http.put(xively_url, {"X-ApiKey":API_KEY, "Content-Type":"text/csv", "User-Agent":"Xively-Imp-Lib/1.0"}, feedCSV); | |
| local response = request.sendsync(); | |
| if(response.statuscode != 200) { |
This file contains hidden or 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
| /* | |
| * Add a method to File class: A variation of eachLine that accepts a stopClosure | |
| */ | |
| File.metaClass.eachLineBreak = { stopClosure, workClosure -> | |
| for (Iterator iter = delegate.iterator(); iter.hasNext();) { | |
| def value = iter.next() | |
| if (stopClosure.call(value)) { | |
| break | |
| } else { | |
| workClosure.call(value) |
This file contains hidden or 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
| select | |
| b.uniqueness, a.index_name, a.table_name, a.column_name | |
| from | |
| all_ind_columns a, all_indexes b | |
| where | |
| a.index_name=b.index_name and | |
| a.table_name = upper('&table_name') | |
| order by | |
| a.table_name, a.index_name, a.column_position; |