Skip to content

Instantly share code, notes, and snippets.

@curtisz
curtisz / parseurl.js
Created November 9, 2015 23:07
RFC 3986 URL Parsing Regular Expression (JavaScript)
/* ***********************************************************************************
Hero authors of RFC 3986 (http://www.ietf.org/rfc/rfc3986.txt) gave us this regex
for parsing (well-formed) URLs into their constituent pieces:
^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?
Which for the following URL:
http://www.ics.uci.edu/pub/ietf/uri/#Related
@AlienDeg
AlienDeg / sightseeing.R
Last active October 18, 2017 18:37
sightseeing optimization for people who like to walk
library(ggmap)
library(gtools)
library(dplyr)
library(ggplot2)
library(ggrepel)
what_to_see <- c('prague bus station',
"Pivo a parek, prague",
"Bar Na Palme, prague",
"Pivovar Hostivar,pragie",
"Pivni rozmanitost, prague",
@CharlyWargnier
CharlyWargnier / GTP3_script_for_sheets.txt
Created January 15, 2023 15:00
A script to integrate GTP3 in Google Sheets
const OPENAI_API_KEY = ""; // <- PASTE YOUR SECRET KEY HERE
const OPENAI_API_URL = "https://api.openai.com/v1/completions";
/**
* Submits a prompt to GPT-3 and returns the completion
*
* @param {string} prompt Prompt to submit to GPT-3
* @param {float} temperature Model temperature (0-1)
* @param {string} model Model name (e.g. text-davinci-002)