title: "First day with APItools (at BattleHack)" description: "This weekend I attended BattleHack hackathon in San Francisco and I thought I could give APItools a try. Here are some thoughts and feedback about using APItools in hackathon conditions." layout: blog author: Nicolas gh-author: picsoung date: 2014-04-02 categories: blog tags: hackathons CORS
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 fastapi import FastAPI,Request,HTTPException | |
import hashlib | |
import hmac | |
import json | |
import base64 | |
import os | |
app = FastAPI() |
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 { | |
IExecuteFunctions, | |
} from 'n8n-core'; | |
import { | |
IDataObject, | |
INodeExecutionData, | |
INodeType, | |
INodeTypeDescription, | |
} from 'n8n-workflow'; |
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
let {current_day, EXCLUDE_WEEKENDS,INTERVAL} = inputData | |
let dates = [] | |
let j = 1; | |
do{ | |
let d = new Date(current_day); | |
d.setDate(d.getDate()+j) | |
if(EXCLUDE_WEEKENDS==="true"){//exclude weekends | |
if(d.getDay() === 6){ //saturday | |
d.setDate(d.getDate() + 2); |
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
Afghanistan | |
Afrique du Sud | |
Albanie | |
Algérie | |
Allemagne | |
Andorre | |
Angola | |
Anguilla | |
Antarctique | |
Antigua-et-Barbuda |
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
{ | |
"form_id": "3a1130ad-b534-4893-87e9-e9695765ec29", | |
"organization_id": "3c4c165b-0727-4615-960f-8b1f593915ca", | |
"title": "Logic VA", | |
"requires_contact_info": false, | |
"requires_contact_email": false, | |
"requires_contact_name": false, | |
"requires_contact_phone_number": false, | |
"requires_consent": false, | |
"show_contact_name": false, |
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
//Replace with yours | |
let TYPEFORM_URL = "https://picsoung.typeform.com/to/QXS2h1?utm_source=cf_workers" | |
addEventListener('fetch', event => { | |
event.respondWith(handleRequest(event.request)) | |
}) | |
async function handleRequest(request) { | |
let response = await fetch(TYPEFORM_URL) |
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
{ | |
"choices": [ | |
{ | |
"label": "San Francisco", | |
"slug": "san-francisco", | |
"image":"https://d13k13wj6adfdf.cloudfront.net/urban_areas/san-francisco-bay-area-7f6d130d20.jpg" | |
}, | |
{ | |
"label": "Barcelona", | |
"slug": "barcelona", |
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
cont fs = require('fs'); | |
let wav = new WaveFile(fs.readFileSync(`hello_${username}.wav`)); | |
let wav64 = wav.toBase64() | |
axios({ | |
method: 'POST', | |
url: `http://${ROBOT_IP}/api/audio`, | |
data:{ | |
FileName: `hello_${username}.wav`, | |
Data: wav64, |
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 { form_response } = req.body | |
const {answers} = form_response | |
let arm_field = answers.find((a) => a.field.ref === 'arm_choice') | |
let selected_arm = arm_field.choice.label | |
let username_field = answers.find((a) => a.field.ref === 'username') | |
let username = username_field.text |