Skip to content

Instantly share code, notes, and snippets.

View Raidus's full-sized avatar

Wilhelm R. Raidus

View GitHub Profile
@Raidus
Raidus / flatten-array.js
Created August 8, 2017 00:50 — forked from Integralist/flatten-array.js
Array flatten function written in ES6 syntax
const flattenTco = ([first, ...rest], accumulator) =>
(first === undefined)
? accumulator
: (Array.isArray(first))
? flattenTco([...first, ...rest])
: flattenTco(rest, accumulator.concat(first))
const flatten = (n) => flattenTco(n, []);
console.log(flatten([[1,[2,[[3]]]],4,[5,[[[6]]]]]))
// Abort pagination when current page fulfills certain condition
const rp = require('request-promise');
const Xray = require('x-ray');
const x = Xray({
filters: {
correctURI: function(value) {
return typeof value === 'string'
? `https://www.amazon.de${value}`
@Raidus
Raidus / eltool.sh
Created October 11, 2017 08:39 — forked from dimkir/eltool.sh
Tool for building dependencies for electron on Amazon Linux (and maybe on CentOS / RHEL)
#!/bin/bash
DIST_DEPS=0
CENTOS_DEPS=0
GCONF_COMPILE=0
GCONF_INSTALL=0
PIXBUF_INSTALL=0
PIXBUF_COMPILE=0
@Raidus
Raidus / eltool.sh
Last active October 11, 2017 08:41 — forked from dimkir/eltool.sh
Tool for building dependencies for electron on Amazon Linux (and maybe on CentOS / RHEL)
#!/bin/bash
DIST_DEPS=0
CENTOS_DEPS=0
GCONF_COMPILE=0
GCONF_INSTALL=0
PIXBUF_INSTALL=0
PIXBUF_COMPILE=0
@Raidus
Raidus / nightmare-on-amazon-linux.MD
Last active October 11, 2017 08:51 — forked from dimkir/nightmare-on-amazon-linux.MD
How to run nightmare on Amazon Linux

Running nightmare on Amazon Linux

You may have thought of running nightmare on AWS Lambda. But before we can run it on Lambda, we need first to make it run on Amazon Linux.

Provision instance which replicates Lambda environment

According to AWS Documentation on Lambda Execution Environment and available Libraries we would need this AMI image with this alias amzn-ami-hvm-2016.03.3.x86_64-gp2. Keep in mind that AMI-image-id for this instance would be different in different regions (eg):

  • In eu-west-1 - ami-f9dd458a
  • In us-east-1 - ami-6869aa05
@Raidus
Raidus / .babelrc
Created October 30, 2017 11:41 — forked from thejmazz/.babelrc
async/await with webpack+babel
{
"presets": ["es2015"],
"plugins": ["transform-async-to-generator"]
}
@Raidus
Raidus / schema-generator.js
Created November 15, 2017 14:38 — forked from oyvindholmstad/schema-generator.js
BigQuery JSON schema generator in Javascript and Scala
/*
A script to generate a Google BigQuery-complient JSON-schema from a JSON object.
Make sure the JSON object is complete before generating, null values will be skipped.
References:
https://cloud.google.com/bigquery/docs/data
https://cloud.google.com/bigquery/docs/personsDataSchema.json
https://gist.github.com/igrigorik/83334277835625916cd6
... and a couple of visits to StackOverflow
@Raidus
Raidus / Node_AWS_Linux.md
Created November 25, 2017 22:25 — forked from nrollr/Node_AWS_Linux.md
Install Node.js on Amazon Linux (EC2)

Installing Node.js on Amazon Linux AMI

The following will guide you through the process of installing Node.js on an AWS EC2 instance running Amazon Linux AMI 2016.09 - Release Notes

For this process I'll be using a t2.micro EC2 instance running Amazon Linux AMI (ami-d41d58a7). Once the EC2 instance is up-and-running, connect to your server via ssh

@Raidus
Raidus / check_cpu_credits.sh
Created January 7, 2018 18:31 — forked from daniilyar-confyrm/check_cpu_credits.sh
[Nagios-check] AWS EC2 - check how much CPU credits are left at the instance
#!/bin/bash
set -e
OK=0
WARN=1
CRIT=2
UNKNOWN=3
function get_warning_limit {
@Raidus
Raidus / README.md
Created May 3, 2018 18:08 — forked from meyerdan/README.md
Human consumable text format for simple workflows

Motivation

Allow developers to specify workflows without the need for installing additional tooling such as a modeler.

Goals

  • It should be easy to define a simple workflow with a text editor only
  • The format must map down directly to BPMN
  • The format must be based on an existing text based format like (XML, JSON, YAML, TOML, ...)