Skip to content

Instantly share code, notes, and snippets.

Avatar

Luke van der Hoeven plukevdh

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

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:

View Jenkinsfile
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
Dynamic Pipeline Flow Example
View pipeline-flow.groovy
// 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 Oct 24, 2016
Ramda - Type Detection Functions
View detect.js
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 Sep 29, 2016
simple md5 hash digetsing
View hash.rb
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 Mar 24, 2021
Ramda - Compact diff output for complex objects.
View objectDiff.js
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 Sep 21, 2016
Ramda - Group two objects' values by keys
View groupByKey.js
const groupByKey = R.compose(
R.groupBy(R.head),
R.apply(R.concat),
R.map(R.toPairs)
)
@plukevdh
plukevdh / abortable_run.rb
Created Nov 3, 2015
Helps with chaining system commands and aborting when fails occur
View abortable_run.rb
def abortable_run(cmd)
abort("Failed with #{$?.exitstatus}") unless system(cmd)
end
@plukevdh
plukevdh / benchmark.rb
Last active Aug 26, 2015
Call comparisons
View benchmark.rb
class Processor
def plus_two(arg)
arg + 2
end
end
class Runner
def block_run(arg, &block)
yield arg
end