View serve-brotli.js
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
const path = require('path') | |
const { readFileSync } = require('fs') | |
exports.handler = async function http (req) { | |
let here = path.dirname('.') | |
let postsFilePath = path.join(here, 'rss.xml.br') | |
let posts = readFileSync(postsFilePath, 'binary') | |
console.log(posts.length) |
View sent-toot.mjs
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 Meg from 'megalodon' | |
const { default: generator } = Meg | |
// switch to your mastodon server | |
const BASE_URL = 'https://mastodon.online/' | |
const access_token = process.env.MASTODON_TOKEN | |
export async function handler (event) { | |
const {title, link, description} = JSON.parse(event.Records[0].Sns.Message) |
View owenv
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
function owenv() { | |
bold=$(tput bold) | |
normal=$(tput sgr0) | |
switches="" | |
space=$1 | |
case "$space" in | |
"cloudshell") | |
host=runtime.adobe.io | |
key=<api key> |
View wolfram.js
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
const fetch = require('node-fetch'); | |
const credentials = require('./credentials'); | |
module.exports = async function(context, req) { | |
if (req.query.searchTerm || (req.body && req.body.searchTerm)) { | |
const searchTerm = req.query.searchTerm || | |
req.body.searchTerm; | |
let url = `http://api.wolframalpha.com/v2/query?input=${searchTerm}&appid=${ | |
credentials.wolfram | |
}`; |
View translate.js
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
const fetch = require('node-fetch'); | |
const credentials = require('./credentials'); | |
module.exports = async function(context, req) { | |
if (req.query.searchTerm || (req.body && req.body.searchTerm)) { | |
const searchTerm = req.query.searchTerm || | |
req.body.searchTerm; | |
let url = `https://www.googleapis.com/language/translate/v2?key=${ | |
credentials.google | |
}&source=en&target=fr&q=${searchTerm}`; |
View server.js
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
'use strict'; | |
const Hapi = require('hapi'); | |
const Joi = require('joi'); | |
const fetch = require('node-fetch'); | |
const credentials = require('./credentials'); | |
const server = Hapi.server({ | |
host: '0.0.0.0', | |
port: 8000 |
View index-padleft.js
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
const leftPad = require('left-pad'); | |
function main(args) { | |
const name = args.name || 'World'; | |
return { payload: `Hello, ${leftPad(name, 30, ".")}!` }; | |
} | |
global.main = main; |
View index.js
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
function main(args) { | |
return { payload: 'Hello world' }; | |
} | |
global.main = main; |
View handler-padleft.js
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
'use strict'; | |
const leftPad = require('left-pad'); | |
function hello(params) { | |
const name = params.name || 'World'; | |
return { payload: `Hello, ${leftPad(name, 30, ".")}!` }; | |
} | |
exports.hello = hello; |
View handler.js
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
'use strict'; | |
function hello(params) { | |
const name = params.name || 'World'; | |
return { payload: `Hello, ${name}!` }; | |
} | |
exports.hello = hello; |
NewerOlder