Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@lornajane
lornajane / sidebars-script.js
Created December 1, 2023 20:56
Sidebar munging
const fs = require('fs');
const yaml = require('js-yaml');
const cheerio = require("cheerio");
const sidebars_file = "sidebars.yaml";
async function getTitle(url) {
await fetch(url)
.then(result => result.text())
.then(html => {
@lornajane
lornajane / my-custom-plugin.js
Last active April 17, 2023 12:17
Redocly custom rule from built-in rule
const NamedBooleans = require('./rules/named-booleans');
module.exports = {
id: 'extras-plugin',
rules: {
oas3: {
'boolean-naming-rules': NamedBooleans,
}
}
@lornajane
lornajane / Sphinx-Devportal-Resources.md
Last active October 4, 2021 10:16
List of resources for Sphinx used by Aiven's Developer Portal
@lornajane
lornajane / app.py
Created July 13, 2020 13:22
Very simple Flask webhook receiver
import logging
import pprint
from flask import Flask
from flask import jsonify
from flask import request
from pprint import pformat
app = Flask(__name__)
logging.basicConfig(level=logging.DEBUG)
@lornajane
lornajane / guzzle-github.php
Created May 12, 2020 12:36
Leeds PHP: Guzzle and SDKs Example Snippets
<?php
// composer require guzzlehttp/guzzle
require "vendor/autoload.php";
$client = new GuzzleHttp\Client(["base_uri" => "https://api.github.com/"]);
try {
$response = $client->get("/users/lornajane/repos");
if($response->getStatusCode() == 200) {
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
<title>How to use rst2pdf</title>
<meta name="author" content="Roberto Alsina &lt;ralsina&#64;netmanagers.com.ar&gt;" />
<style type="text/css">
@lornajane
lornajane / hi-conf.json
Last active August 21, 2018 14:20
NCCO greets, then silence
[
{
"action": "talk",
"voiceName": "Salli",
"text": "Your call is connected, you will now join the conference"
},
{
"action": "conversation",
"name": "conf5678"
}
UUID=$(curl -s -X POST https://api.nexmo.com/v1/calls \
-H "Authorization: Bearer "$JWT\
-H "Content-Type: application/json"\
-d '{"to":[{"type": "phone","number": "'$TO_NUMBER'"}],
"from": {"type": "phone","number": "'$NEXMO_NUMBER'"},
"answer_url":["https://developer.nexmo.com/ncco/tts.json"]}' \
| awk -F "[,:]" '/uuid/{print substr($2,2,length($2)-2)}')
@lornajane
lornajane / notifier.js
Created November 17, 2017 15:47
Send a webhook from serverless js on openwhisk
function main(data) {
return new Promise(function(resolve, reject) {
var request = require('request');
if(data.status == 'new') {
var message = "New question: <" + data.question.link + "|" + data.question.title + "> (tagged: " + data.question.tags + ")";
var options = {
"text": message,
"icon_emoji": ":postit:"
// fetch document or return null
function getDoc(db, id) {
return new Promise(function(resolve, reject) {
db.get(id).then(resolve).catch(function(err) {
resolve(null);
});
});
};
function main(message) {