Setup:
$ mongo
> use pubsub
> db.createCollection('messages', { capped: true, size: 100000 })
> db.messages.insert({})
| /* Sample JavaScript file added with ScriptTag resource. | |
| This sample file is meant to teach best practices. | |
| Your app will load jQuery if it's not defined. | |
| Your app will load jQuery if jQuery is defined but is too old, e.g. < 1.7. | |
| Your app does not change the definition of $ or jQuery outside the app. | |
| Example: if a Shopify theme uses jQuery 1.4.2, both of these statements run in the console will still return '1.4.2' | |
| once the app is installed, even if the app uses jQuery 1.9.1: | |
| jQuery.fn.jquery => "1.4.2" | |
| $.fn.jquery -> "1.4.2" | |
| */ |
| // Send cookies for the socket.io handshake (sails.js) | |
| // Based on https://gist.github.com/jfromaniello/4087861 | |
| // Socket.io open ticket (started by jfromaniello): | |
| // https://github.com/LearnBoost/socket.io-client/pull/512 | |
| var io = require('socket.io-client'); | |
| var request = require('request'); | |
| var xhr = require('socket.io-client/node_modules/xmlhttprequest'); | |
| var xhrOriginal = require('xmlhttprequest'); |
| #!/bin/bash | |
| PWD=`pwd` | |
| echo "configuring es_river(s)" | |
| # return a list of collections except the system tables | |
| collections=`mongo --host ${MONGODB_SERVER} --username ${MONGODB_USER} --password ${MONGODB_PASSWORD} ${MONGODB_DATABASE} --eval 'db.getCollectionNames().filter(function (c) { return /^((?!system).)*$/.test(c) && /^((?!sessions).)*$/.test(c) })' | sed -n '3p' | sed 's/,/ /g'` | |
| echo "collections: ${collections}" |
| #!/bin/bash | |
| #Shell script that pulls down and clones all available repos for an organization - can be used as a "backup" utility | |
| #Pre-reqs = jsawk https://github.com/micha/jsawk | |
| #don't forget to export out your username and password as variables or maybe add a couple of parameters to accept them as input args | |
| #export GITHUB_USERNAME=my_github_username | |
| #export GITHUB_PASSWORD=my_github_password | |
| echo "getting list of available repos" | |
| PAGE_NUMBER=1 | |
| ORG=$1 |
| /* Sample JavaScript file added with ScriptTag resource. | |
| This sample file is meant to teach best practices. | |
| Your app will load jQuery if it's not defined. | |
| Your app will load jQuery if jQuery is defined but is too old, e.g. < 1.7. | |
| Your app does not change the definition of $ or jQuery outside the app. | |
| Example: if a Shopify theme uses jQuery 1.4.2, both of these statements run in the console will still return '1.4.2' | |
| once the app is installed, even if the app uses jQuery 1.9.1: | |
| jQuery.fn.jquery => "1.4.2" | |
| $.fn.jquery -> "1.4.2" | |
| */ |
#!/usr/bin/python
# function that accepts 2 arrays.
# The arrays contain numbers and each input array is already sorted in increasing order.
# The function should create and return another array which contains all of the numbers that are in the 2 input arrays.
# The numbers in the returned array should also be sorted in increasing order
# Example usage: python process_numbers.py [1,10,3,22,23,4,2,200,201,202,203,204,205,206,207,207,209] [5,8,9,11,25]
import sys
| 'use strict'; | |
| const EventEmitter = require('events').EventEmitter; | |
| const SomeClass = (() => { | |
| class SomeClass extends SomeOtherClass { | |
| constructor() { | |
| super(); | |
| EventEmitter.call(this); | |
| } |
| #!/usr/bin/env python | |
| import os | |
| import argparse | |
| import binascii | |
| from sys import argv, stdout | |
| # default values | |
| DEFAULT_ENTROPY = 4096*16 |
| property idleTest : 180 -- How long to be idle (in seconds) before activating script | |
| on idle_time() | |
| set idleTime to (do shell script "ioreg -c IOHIDSystem | perl -ane 'if (/Idle/) {$idle=(pop @F)/1000000000; print $idle,\"\";last}'") | |
| return idleTime | |
| end idle_time | |
| script should_run_matrix | |
| set idleComp to false | |
| -- this repeat loop polls the idle time every 30 seconds to determine |