jq is useful to slice, filter, map and transform structured json data.
brew install jq
// ==UserScript== | |
// @name No More HN Discussions | |
// @version 0.0.1 | |
// @grant none | |
// @include https://news.ycombinator.com/* | |
// ==/UserScript== | |
// hide all comments | |
const allTableLinks = document.querySelectorAll('td.subtext > a') |
// ==UserScript== | |
// @name Jenkins - select all plugins | |
// @version 0.1 | |
// @description provides a utility button to allow you to select all Jenkins plugins at once | |
// @author Alex Chesters | |
// @match https://ci.itv.test.tools.bbc.co.uk/pluginManager/ | |
// ==/UserScript== | |
const selectAll = () => { | |
const allInputs = document.querySelectorAll('table input') |
const UKPD = require('ukpd') | |
try { | |
const data = await UKPD.streetLevel('52.629729', '-1.131592', '2016-07') | |
console.log(`there were ${data.length} crimes in the area during 2016-07`) | |
} catch (err) { | |
console.error('An error occurred', err) | |
} |
const invertPromise = (promise) => new Promise( | |
(resolve, reject) => promise.then(reject, resolve) | |
) | |
const raceToSuccess = (promises) => invertPromise( | |
Promise.all(promises.map(invertPromise)) | |
) | |
const fast = () => { | |
return new Promise((resolve) => { |
{ | |
"Description": "A Budget, with alarm, to monitor My Component", | |
"Resources": { | |
"EmailTopic": { | |
"Type": "AWS::SNS::Topic", | |
"Properties": { | |
"Subscription": [ | |
{ | |
"Endpoint": "bill.bob@gmail.com", | |
"Protocol": "email" |
import boto3 | |
client = boto3.client(‘rekognition’, region_name=’eu-west-1') | |
def compare_faces(source_image_path, target_image_path): | |
source_image = open(source_image_path, ‘rb’) | |
target_image = open(target_image_path, ‘rb’) | |
response = client.compare_faces( | |
SourceImage={‘Bytes’: bytearray(source_image.read())}, | |
TargetImage={‘Bytes’: bytearray(target_image.read())} | |
) |
stage('Set the build display name') { | |
steps { | |
script { | |
CURRENT_BRANCH = sh(returnStdout: true, script: 'git rev-parse --abbrev-ref HEAD').trim() | |
CURRENT_HASH = sh(returnStdout: true, script: 'git rev-parse --short HEAD').trim() | |
currentBuild.displayName = "$CURRENT_BRANCH - $CURRENT_HASH" | |
} | |
} | |
} |
pipeline { | |
stages { | |
stage('Preparation') { | |
env.mvnHome = tool 'M3' | |
} | |
stage('Build') { | |
sh "'${mvnHome}/bin/mvn' -Dmaven.test.failure.ignore clean package" | |
} | |
} | |
post { |