Skip to content

Instantly share code, notes, and snippets.


Operations Research Engineering Software+ ORESoftware

Block or report user

Report or block ORESoftware

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ORESoftware / cluster.log
Last active Sep 10, 2019
docker-compose logs for mongodb cluster
View cluster.log
Attaching to rydell-mongo-config-03, rydell-mongo-config-02, rydell-mongo-config-01, rydell-shard-03-node-a, rydell-shard-01-node-a, rydell-shard-02-node-a, rydell-router-02, rydell-router-01, rydell-shard-03-node-b, rydell-shard-01-node-b, rydell-shard-02-node-b, rydell-shard-02-node-c, rydell-shard-03-node-c, rydell-shard-01-node-c
rydell-mongo-config-02 | 2019-09-10T02:57:20.550+0000 I STORAGE [main] Max cache overflow file size custom option: 0
rydell-mongo-config-02 | 2019-09-10T02:57:20.552+0000 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
rydell-mongo-config-02 | 2019-09-10T02:57:20.555+0000 I CONTROL [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/configdb 64-bit host=c569f8378ff2
rydell-mongo-config-02 | 2019-09-10T02:57:20.555+0000 I CONTROL [initandlisten] db version v4.0.12
rydell-mongo-config-02 | 2019-09-10T02:57:20.555+0000 I CONTROL [initandlisten] git version:
ORESoftware /
Last active Aug 26, 2019
Stdout/stderr for writing between procs can be faulty if extra stdio is included

Here is some node.js code:

#!/usr/bin/env node

const fs = require('fs');

const header = '#!/usr/bin/env bash\n\n';
try {
  const bytes = fs.writeSync(3, header, 0);
ORESoftware / spread.js
Created Jun 25, 2019
spread operator to merge / mixin objects
View spread.js
const a = {
a: {
b: {
c: 4,
d: 'str'
ORESoftware /
Created Jun 5, 2019
JQ does not make it easy to sanitize strings for JSON inclusion
hist='sed '0,1d' "$HOME/my_bash_history" | wc -l' ### <<< we have some double quotes to escape
data="$( jq -nc --arg str "$hist" '{"attr": $str}' )"
echo "data: $data"
hist="$(echo "$data" | jq -r '.attr')"
echo "hist: $hist" # damnit it's back to where it was before
ORESoftware /
Last active May 28, 2019
Cleanup docker artifacts/items

Clean up docker images/containers/volumes/networks

#!/usr/bin/env bash

set +e;
ORESoftware /
Created May 21, 2019
push event payload from Bitbucket API

Here is a sample push payload from bitbucket API:

    "push": {
      "changes": [
          "forced": false,
          "old": {
ORESoftware /
Created May 18, 2019
Removing old unneeded commits - saving disk space and making git clones faster

Say my git repo has 5,000 commits, how can I remove the first 4,000 commits that are quite old and no longer needed, in order to save disk space?

by Sebass van Boxel, Solutions Engineer at GitHub (2018-present)

First of all, I would try less destructive ways to clean up disk space in your git project. If you're collaborating on a repository with others, it's considered a bad practice to rewrite published history. If you’ve already decided that this is what you want to do, please skip the first part. One of the great powers of Git is that it preserves all history. Often you only realize that you really needed that history when it isn’t there anymore. For new people that join your project, it can be of great value to know what happened for what reason, by “removing” those old commits, they'll lose that context. My advice, before anything else, would be to run Git’s built-in housekeeping task:

ORESoftware / promises-in-series.js
Last active May 7, 2019
Run promises in series with an initial value
View promises-in-series.js
// promises are wrapped in a function - known as "promise-providers"
const providers = [
return Promise.resolve(v+1);
ORESoftware / my.Dockerfile
Created May 3, 2019
caching steps using git pull
View my.Dockerfile
RUN git clone x
RUN git pull
RUN npm install
# the problem is that npm install will always run
# but we can do this instead
ORESoftware / apache.conf
Created Apr 30, 2019
Default apache conf contents
View apache.conf
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:> for detailed information.
# In particular, see
# <URL:>
# for a discussion of each configuration directive.
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
You can’t perform that action at this time.