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 debug = require('debug')('nodemon'); | |
| var utils = require('../utils'); | |
| var bus = utils.bus; | |
| var childProcess = require('child_process'); | |
| var spawn = childProcess.spawn; | |
| var exec = childProcess.exec; | |
| var watch = require('./watch').watch; | |
| var config = require('../config'); | |
| var child = null; // the actual child process we spawn | |
| var killedAfterChange = false; |
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
| { | |
| "name": "broken", | |
| "private": true, | |
| "version": "0.0.1", | |
| "scripts": { | |
| "test-football-formulas": "jasmine www/formulas/test/football_formulas_tests.js", | |
| "dev-scripts": "npm run hgrc && npm run create-env", | |
| "dev": "webpack-dev-server --config=webpack.config.js --progress --hot", | |
| "preinstall": "npm prune", | |
| "predevsilent": "npm run dev-scripts", |
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
| // By slack user ronz | |
| query | |
| .changes({includeInitial: true, includeStates: true, includeTypes: true}) | |
| .pluck('type', 'state') | |
| .filter(row => row('type').ne('change')) | |
| .fold( | |
| 0, | |
| (acc, next) => r.branch( | |
| r.or(next('type').eq('add'), next('type').eq('initial')), | |
| acc.add(1), |
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
| r.db("rethinkdb").table("stats") | |
| .hasFields('db', 'table') | |
| .group('db', 'table') | |
| .map(doc => ({ | |
| reads: doc('storage_engine')('disk')('read_bytes_total').default(0), | |
| writes: doc('storage_engine')('disk')('written_bytes_total').default(0) | |
| })) | |
| .ungroup() | |
| .map(doc => ({ | |
| db: doc('group').nth(0), |
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
| r.db("rethinkdb").table("table_config") | |
| .hasFields('db', 'name') | |
| .concatMap(doc => [{ | |
| db: doc('db'), | |
| table: doc('name'), | |
| shards: doc('shards').count(), | |
| replicas: doc('shards').nth(0)('replicas').count(), | |
| }]) | |
| // this part is dumb - assuming you have 4 main servers, | |
| // and that ONLY tables with 5 total replicas have 5 replicas |
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
| r.db("rethinkdb").table("stats") | |
| .hasFields('db', 'table') | |
| .group('db', 'table') | |
| .map(doc => doc('storage_engine')('disk')('space_usage')('data_bytes').default(0)) | |
| .sum() | |
| .ungroup() | |
| .map(doc => ({db: doc('group').nth(0), table: doc('group').nth(1), size: doc('reduction').div(1024).div(1024)})) | |
| .orderBy(r.desc('size')); |
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
| r.db('rethinkdb').table('table_status') | |
| .filter(r.row('status')('ready_for_writes').not()) | |
| .forEach((tbl)=>{ | |
| return r.db(tbl('db')).table(tbl('name')).reconfigure({emergency_repair: 'unsafe_rollback'}); | |
| }) |
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 Promise = require('bluebird'); | |
| var util = require('util'); | |
| var heapdump = require('heapdump'); | |
| function log(message) { | |
| console.log(new Date().toISOString() + ' - ' + message); | |
| } | |
| function gc() { | |
| log('-- Forced GC'); |
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
| return r.db('db1').table('table1') | |
| .getAll('asdfgh', {index: 'user_id'}) | |
| .orderBy(r.desc('created')) | |
| .fold([], function (acc, doc) { | |
| return r.branch( | |
| acc.isEmpty(), | |
| acc.add([doc]), | |
| acc.nth(-1)('transaction_type').eq(doc('transaction_type')), | |
| acc.slice(0, -1).append(acc.nth(-1).merge({ | |
| amount: acc.nth(-1)('amount').add(doc('amount')) |
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
| /** | |
| * Created by milan on 2016-04-02. | |
| * HappyLog skeleton generator (DokuWiki format) | |
| */ | |
| "use strict"; | |
| let strftime = require('strftime'); | |
| let day = new Date(); | |
| day.setDate(1); | |
| day.setMonth(day.getMonth()); | |
| let month = day.getMonth(); |