This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
{ # this ensures the entire script is downloaded # | |
nvm_has() { | |
type "$1" > /dev/null 2>&1 | |
} | |
nvm_echo() { | |
command printf %s\\n "$*" 2>/dev/null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from urllib.request import urlopen, Request | |
url = "https://swapi.dev/api/people/42/" | |
httprequest = Request(url, headers={"Accept": "application/json"}) | |
with urlopen(httprequest) as response: | |
print(response.status) | |
print(response.read().decode()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DRONE_SERVER_PROTO=http | |
DRONE_SERVER_HOST=VM_EXTERNAL_IP | |
DRONE_GITHUB_SERVER=https://github.com | |
DRONE_GITHUB_CLIENT_ID=GITHUB_CLIENT_ID | |
DRONE_GITHUB_CLIENT_SECRET=GITHUB_CLIENT_SECRET | |
DRONE_RUNNER_CAPACITY=2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DRONE_SERVER_PROTO=https | |
DRONE_SERVER_HOST=VM_EXTERNAL_IP | |
DRONE_GITHUB_SERVER=https://github.com | |
DRONE_GITHUB_CLIENT_ID=GITHUB_CLIENT_ID | |
DRONE_GITHUB_CLIENT_SECRET=GITHUB_CLIENT_SECRET | |
DRONE_RUNNER_CAPACITY=2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require("aws-sdk"); | |
const s3 = new AWS.S3(); | |
exports.handler = async (event) => { | |
console.info(event); | |
try { | |
const consolidationRequestFile = await s3.getObject(event.payload.s3Uri); | |
const consolidationRequest = consolidationRequestFile.Body; | |
let consolidationLabels = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ocrResults = require("./ocr-results.json"); | |
const dataLocation = "<Data location in S3 bucket>"; | |
exports.handler = async (event) => { | |
console.info(event); | |
const fileName = event.dataObject['source-ref'].substr(dataLocation.length); | |
const extracts = ocrResults[fileName] || {rekognition: "__error.rekognition__", gcVision: "__error.gcVision__"}; | |
console.info(extracts); | |
const categories = [extracts["rekognition"], extracts["gcVision"], "Neither"]; | |
const response = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getSMSText = async (warning, id, introduced) => { | |
const text = notificationTemplate[warning.type].find(group => | |
group.categories.includes(warning.category) | |
).sentences[introduced ? 'next' : '1st']; | |
const link = await googl.shorten(`${decodeURIComponent(warning.url)}${id}`); | |
return `${text} ${link}`; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get SHA256 of a text | |
# Usage: sha256 password | |
# output: 5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8 | |
function sha256() { | |
echo -n $1 | shasum -a 256 | |
# Source: http://albertech.blogspot.fr/2015/02/generate-sha-256-hash-from-command-line.html | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7.days.since(Time.now).to_date.strftime("%d/%m/%Y") |
NewerOlder