Skip to content

Instantly share code, notes, and snippets.

import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
response = openai.Completion.create(
engine="davinci-instruct-beta-v3",
prompt="Create prompts to render fictional people at different ages and nationalities.\n\n1. A watercolor painting",
temperature=0.7,
max_tokens=64,
var express = require('express');
var app = express();
app.listen(80, function() {
console.log('Chatfuel Bot-Server listening on port 80...');
});
app.get('/*', function(req, res) {
var jsonResponse = [];
jsonResponse.push({ "text": "Hi. " + (Math.random() * 5 + 1).toFixed(0) + " is a lucky number..." });
// You can find all three of these in the "Account Details" section of your Cloudinary Dashboard.
var cloudinaryCloudName = "";
var cloudinaryApiKey = "";
var cloudinaryApiSecret = "";
// Upload a semi-transparent PNG file to your Cloudinary account. This semi-transparent image will be used as the watermark. Then, enter the name (Public ID) of that image below. Learn more at http://cloudinary.com/blog/adding_watermarks_credits_badges_and_text_overlays_to_images
var watermarkImageName = "";
@jdnichollsc
jdnichollsc / Codes
Last active June 22, 2023 19:04
Ionic Framework Links
- Ejemplo de Gulp con Ionic => https://gist.github.com/jdnichollsc/e3a323223fcb7822dbba
- SQLite con ngCordova usando patrón de servicio y promesas => https://gist.github.com/jdnichollsc/9ac79aaa3407e92677ba
- Permitir dinamicamente arrastrar elementos de una Lista => https://gist.github.com/mhartington/c5107ccd9204b755442b
- Obtener datos consumiendo un servicio REST o desde el LocalStorage => https://gist.github.com/jdnichollsc/7367fe5b17369e856157
- Cambiar el tamaño de un Modal => https://gist.github.com/jdnichollsc/1b0112dfdca4b7f06fbe
- OAuth Authentication, Firebase 3 and ngCordovaOauth => https://gist.github.com/jdnichollsc/17bae6581d405321937fe433410172c9
- Firebase Upload Files => https://gist.github.com/jdnichollsc/5ddc40c1c482e6209a8f4d634fd11d1e
- Download and Open Files => https://gist.github.com/jdnichollsc/1e
# scrape e-Compras GDF (https://www.compras.df.gov.br/)
import os
import requests
from bs4 import BeautifulSoup
baseurl = 'https://www.compras.df.gov.br/publico/'
basepath = '/Users/thiagomarzagao/Desktop/HTML/'
primeiro_id = 0 # ID of the first auction
ultimo_id = 48355 # ID of the last auction (as of 12/18/14)
@mharsch
mharsch / gist:5943801
Last active April 18, 2018 11:38
Roomba power supply + serial interface for Raspberry Pi

Roomba exposes both unregulated battery voltage (+14v, GND), and a 5v TTL serial interface via it's mini-din connector. Also exposed is an active-low signal pin called DD (Device Detect) that can be used to wakeup a sleeping/off Roomba.

Rpi has a 3.3v TTL serial interface exposed on it's header pins. Also, Rpi exposes +5v, +3.3v, GND, as well as GPIO pins.

We can leverage the Roomba battery to power the Rpi by adding a voltage regulator circuit between the roomba min-din battery pins and the 5v/GND power pins on the Rpi header. I've chosen the following part from the RC community (called a UBEC Universal Battery Elimination Circuit) to power the Rpi: this or this

To convert the 5v Roomba signals (both serial and DD) to/from 3.3v, I've chosen this:

@liorkesos
liorkesos / File Stucture
Last active December 17, 2015 01:28
A sequence of files which get called and enable an angular.js app The app structure looks like this
app
index.html
app.js
css/
js/
controllers/
youtubeSearch.js
services/
views/
main.html
@chrisl8888
chrisl8888 / drush-turn-off-aggregate-assets.txt
Created September 24, 2012 17:20
drush disable js/css aggregation
// To turn on JS Aggregation
drush vset preprocess_js 1 --yes
// To clear all Cache
drush cc all
// To disable JS Aggregation
drush vset preprocess_js 0 --yes
// To clear cache of JS and CSS only
// Let's start with the basics
$base-color: #333;
$active-color: #ff8100;
$base-gradient: 'flat';
// Buttons
$button-gradient: 'bevel';
// Lists
$list-bg-color: #eee;
@robflaherty
robflaherty / csv-to-json.php
Created September 1, 2011 02:26
Convert CSV to JSON
<?php
/*
* Converts CSV to JSON
* Example uses Google Spreadsheet CSV feed
* csvToArray function I think I found on php.net
*/
header('Content-type: application/json');
// Set your CSV feed