Skip to content

Instantly share code, notes, and snippets.

View plukevdh's full-sized avatar
🔥

Luke van der Hoeven plukevdh

🔥
View GitHub Profile
@plukevdh
plukevdh / transcode.rb
Created June 2, 2018 20:43
Quick and dirty transcoder job
require 'aws-sdk'
Aws.config.update({
region: "us-east-1",
credentials: Aws::SharedCredentials.new(profile_name: "...")
})
PRESET_ID = "..."
PIPELINE_ID = "..."

Keybase proof

I hereby claim:

  • I am plukevdh on github.
  • I am plukevdh (https://keybase.io/plukevdh) on keybase.
  • I have a public key ASAUM0TdYG6iD3RQxK29SEzkPqj18SAcJszaiNe1uZVCzQo

To claim this, I am signing this object:

def envs = [
[env: "stage", region: "us-east-1"]
]
stage("Plan") {
def planJobs = [:]
for(int i = 0; i < envs.size(); i++) {
def details = envs.get(i)
@plukevdh
plukevdh / pipeline-flow.groovy
Last active May 25, 2017 16:41
Dynamic Pipeline Flow Example
// Example envs, could be one of the following
def defaultEnvs = [
[env: "stage", region: "us-east-1"],
[env: "prod", region: "us-east-1"]
]
// Or
def defaultEnvs = [
@plukevdh
plukevdh / detect.js
Created October 24, 2016 18:33
Ramda - Type Detection Functions
const isObject = R.compose(R.equals('Object'), R.type);
const isScalar = R.compose(R.not, R.either(isObject, R.isArrayLike), R.last, R.values);
@plukevdh
plukevdh / hash.rb
Created September 29, 2016 20:33
simple md5 hash digetsing
require 'digest'
require 'fileutils'
EXCLUDES = %w{.rb .md}
def exclude?(path)
EXCLUDES.any? {|pattern| path.end_with? pattern }
end
def md5_name(path)
@plukevdh
plukevdh / objectDiff.js
Last active April 11, 2022 13:56
Ramda - Compact diff output for complex objects.
import R from 'ramda'
const isObject = R.compose(R.equals('Object'), R.type);
const allAreObjects = R.compose(R.all(isObject), R.values);
const hasLeft = R.has('left');
const hasRight = R.has('right');
const hasBoth = R.both(hasLeft, hasRight);
const isEqual = R.both(hasBoth, R.compose(R.apply(R.equals), R.values));
const markAdded = R.compose(R.append(undefined), R.values);
@plukevdh
plukevdh / groupByKey.js
Created September 21, 2016 21:49
Ramda - Group two objects' values by keys
const groupByKey = R.compose(
R.groupBy(R.head),
R.apply(R.concat),
R.map(R.toPairs)
)
@plukevdh
plukevdh / abortable_run.rb
Created November 3, 2015 16:14
Helps with chaining system commands and aborting when fails occur
def abortable_run(cmd)
abort("Failed with #{$?.exitstatus}") unless system(cmd)
end
@plukevdh
plukevdh / benchmark.rb
Last active August 26, 2015 15:43
Call comparisons
class Processor
def plus_two(arg)
arg + 2
end
end
class Runner
def block_run(arg, &block)
yield arg
end