This file contains 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 datetime import datetime, timedelta | |
from requests import get, post | |
GRAFANA_DATE_FORMAT = '%Y-%m-%d %H:%M:%S' | |
GRAFANA_CREDS = ('user', 'password') | |
dashboardResponse = get('https://grafana.host/api/dashboards/a/dashboard', auth = GRAFANA_CREDS) | |
dashboard = dashboardResponse.json()['dashboard'] |
This file contains 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
# On disk local Quartz JobStore using H2; add 'com.h2database:h2:1.4.197' to your dependencies | |
org.quartz.scheduler.instanceName = MyScheduler | |
org.quartz.threadPool.threadCount = 3 | |
# generic jdbc job store | |
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX | |
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate | |
org.quartz.jobStore.dataSource = disk | |
# persist to H2 database at path '/tmp/MyScheduler.quartz.h2' |
This file contains 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 | |
if [ "$#" -lt 1 ] || [ -z "$1" ]; then | |
>&2 echo "Usage: $0 searchTerm [searchResultLimit] # default searchResultLimit is 5" | |
exit 1 | |
fi | |
if [ -z "$(command -v python)" ]; then | |
>&2 echo "$0 requires python to be installed and in the current PATH" | |
exit 1 |
This file contains 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
import javax.ws.rs.core.Response; | |
import java.util.Optional; | |
import java.util.function.Consumer; | |
import java.util.function.Function; | |
import java.util.function.Supplier; | |
import static javax.ws.rs.core.MediaType.TEXT_PLAIN_TYPE; | |
import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR; | |
import static javax.ws.rs.core.Response.Status.OK; |
This file contains 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 ash | |
read -r -d '' PROMPT_LUA << EOM | |
_PROMPT = '[alpine-lua]# ' | |
luarocks = | |
{ | |
install = function(pkg) | |
return os.execute('luarocks install ' .. pkg) | |
end |
This file contains 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
MAX_ID_LENGTH = 10 | |
local generatePseudoUniqueId = function() | |
local threadAddress = tostring({}):sub(10) | |
local threadAddressLetters = threadAddress:gsub("%d", "") | |
local threadAddressNumbers = threadAddress:gsub("[a-z]", "") | |
local threadAddressNumber = tonumber(threadAddressNumbers) | |
local maxNumberWidth = MAX_ID_LENGTH - threadAddressLetters:len() |
This file contains 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
// see: https://www.npmjs.com/package/swagger2-postman-generator | |
const Swagger2Postman = require("swagger2-postman-generator"); | |
function alfrescoRequestPostProcessor(postmanRequest, swaggerSpec) { | |
if (postmanRequest.url.includes("/authentication/versions/1/tickets")) { | |
// add a test post login event to save the ticket to an environment variable | |
postmanRequest.events = [ | |
{ | |
"listen": "test", | |
"script": { |
This file contains 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
// uses Apache commons CSV, IO and Lang | |
import org.apache.commons.csv.CSVFormat; | |
import org.apache.commons.csv.CSVParser; | |
import org.apache.commons.csv.CSVPrinter; | |
import org.apache.commons.io.FileUtils; | |
import org.apache.commons.io.IOUtils; | |
import java.io.*; | |
import java.util.ArrayList; | |
import java.util.List; |
This file contains 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 python3 | |
from argparse import ArgumentParser | |
from getpass import getpass | |
from hashlib import sha1 | |
from itertools import chain | |
from random import choices | |
from sys import stdin | |
SALT_LENGTH = 8 |
This file contains 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 | |
set -e | |
vagrantBaseUrl="https://releases.hashicorp.com" | |
latestRelease=$(\ | |
wget -q -O - "${vagrantBaseUrl}/vagrant/" \ | |
| grep 'a href="' \ | |
| grep -v '<a href="../">../</a>' \ | |
| head -n 1 \ |