Skip to content

Instantly share code, notes, and snippets.

View adrianhorning08's full-sized avatar

Adrian Horning adrianhorning08

View GitHub Profile
@adrianhorning08
adrianhorning08 / gist:d688fc9bc4ca4ef4e6b66a2f3a0268a8
Created May 7, 2018 22:54
Cartesian product of multiple arrays
function printCombos(array) {
var results = [[]];
for (var i = 0; i < array.length; i++) {
var currentSubArray = array[i];
var temp = [];
for (var j = 0; j < results.length; j++) {
for (var k = 0; k < currentSubArray.length; k++) {
temp.push(results[j].concat(currentSubArray[k]));
}
function printCombos(array) {
var results = [[]];
for (var i = 0; i < array.length; i++) {
var currentSubArray = array[i];
var temp = [];
for (var j = 0; j < results.length; j++) {
for (var k = 0; k < currentSubArray.length; k++) {
temp.push(results[j].concat(currentSubArray[k]));
}
function stringReduce(str) {
const set = new Set(str);
return [...set].join('');
}
function findDups(arr) {
const set = new Set();
const result = [];
arr.forEach(el => {
if (set.has(el)) {
result.push(el);
} else {
set.add(el);
}
function validIP(str) {
const arr = str.split('.');
if (arr.length !== 4) return false;
arr.forEach(el => {
if (el > 255 || el < 1) return false;
})
return true;
}
function genPassword(n, filter) {
const variables = {
uppercase:'ABCDEFGHIJKLMNOPQRSTUV',
lowercase: 'abcdefghijklmnopqrstuvwxyz',
nums: '0123456789',
symbols: '!@#$%^&*?<>'
}
CREATE TABLE patients (
mrn VARCHAR NOT NULL UNIQUE PRIMARY KEY,
first_name VARCHAR NOT NULL,
first_name VARCHAR NOT NULL,
maiden_name VARCHAR,
last_name VARCHAR,
birth_date VARCHAR NOT NULL UNIQUE,
birth_date VARCHAR NOT NULL UNIQUE,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
import requests
import json
import smtplib
old_price = 500
def get_price():
try:
url = "https://www.bhphotovideo.com/api/item/p/product-details?from=cli&aperture=1&cliReqId=5ac45968-b1a2-43ad-9118-ef8884f1189f-cli-19"
This file has been truncated, but you can view the full file.
{"prompt":"Compose a twitter thread in the style of @thesamparr based on this topic: Barstool.\n\n###\n\n","completion":" More info on the barstool deal. - Nearly $100m in profitable revenue in 2019. 53% growth in 2018, 65% in 19. So if assume $90m in 2019 then assume $61m in 18 and $32m in 2017 (my math right?) - Was valued at $15m in 2016. - 63% of readers are gamblers. - Goal is to get Barstool's personalities to drive to penn. - Penn's stock is up like 25% since the deal. Market cap is up nearly $1b!!!. - Penn paid $125m in cash for a stake valuing the business at $400m More here:###"}
{"prompt":"Compose a twitter thread in the style of @thesamparr based on this topic: Hair styles.\n\n###\n\n","completion":" Razor shaved my head bald. Holy hell. Feels so good. Have a hawk. But game. To itch all the intchy parts.###"}
{"prompt":"Compose a twitter thread in the style of @thesamparr based on this topic: Thiel Fellowship.\n\n###\n\n","completion":" The Thiel Fellowship gives $100k to 25 kids a year to drop ou
function convertHtml(text) {
const newHtml = text.replace(/&gt;/g, ">").replace(/&lt;/g, "<");
return newHtml;
}
async function renderPageToHtml(page) {
const iframes = await page.$$("iframe");
for (const iframe of iframes) {
const frame = await iframe.contentFrame();
if (!frame) continue;