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
| #!/usr/bin/env sh | |
| TEMPLATE_FILE=$1 | |
| ENV_PREFIX=$2 | |
| env | grep "^$ENV_PREFIX" | while IFS="=" read -r name value; do | |
| printf "s/%s/%q/\n" "${name}" "$value" | |
| done > sed-script.txt | |
| cat sed-script.txt # Optional | |
| sed -f sed-script.txt "$TEMPLATE_FILE" |
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
| DELETE FROM tablename | |
| WHERE id IN (SELECT id | |
| FROM (SELECT id, | |
| ROW_NUMBER() OVER (partition BY column1, column2, column3 ORDER BY id) AS rnum | |
| FROM tablename) t | |
| WHERE t.rnum > 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
| debug = require "debug" | |
| debug.enable('mrc:*') | |
| module.exports = (prefix="", suffix=":") -> | |
| return { | |
| log: debug "#{prefix}log#{suffix}" | |
| debug: debug "#{prefix}debug#{suffix}" | |
| sql: debug "#{prefix}debug:sql#{suffix}" | |
| info: debug "#{prefix}info#{suffix}" | |
| error: debug "#{prefix}error#{suffix}" |
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
| log = require("./logger")("mrc:launcher:") | |
| if require.main == module | |
| file = process.argv[2] | |
| console.log "start", file | |
| target = require file | |
| process.on "message", (args) -> | |
| sendResponse = (status, data) -> | |
| process.send { status, data } | |
| process.exit(0) | |
| return target.apply(undefined, args).then (result) -> |
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
| char *at = strchr(ifName, '@'); | |
| char *topic = (char*)"flow", *endpoint; | |
| if(at != NULL) | |
| endpoint = &at[1]; | |
| else | |
| endpoint = ifName; | |
| iface = new CollectorInterface(endpoint, topic); |
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
| WITH x AS ( | |
| SELECT count(*) AS ct | |
| ,sum(length(t::text)) AS txt_len -- length in characters | |
| ,'TABLENAME'::regclass AS tbl | |
| FROM TABLENAME t | |
| ) | |
| , y AS ( | |
| SELECT ARRAY [ | |
| pg_relation_size(tbl) |
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
| save = () -> | |
| return new Promise (resolve, reject) -> | |
| # do save shit | |
| return resolve() | |
| promises = [] | |
| for i in array | |
| promises.push save(i) |
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
| /* | |
| Promise = require "native-or-bluebird" | |
| checkDatabase = (db) -> | |
| return new Promise (resolve, reject) -> | |
| return db.exists (err, exists) -> | |
| if err? | |
| return reject(err); | |
| if exists | |
| return resolve(db) |
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
| Promise = require "native-or-bluebird" | |
| checkDatabase = (db) -> | |
| return new Promise (resolve, reject) -> | |
| return db.exists (err, exists) -> | |
| if err? | |
| return reject(err); | |
| if exists | |
| return resolve(db) |
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 ECT, app, ectRenderer, express, rc, reacta; | |
| express = require('express'); | |
| reacta = require("reacta"); | |
| app = express(); | |
| ECT = require('ect'); |