# @ your EC2 instance
sudo apt update
sudo apt install openjdk-8-jre unzip
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
unzip sdk-tools-linux-4333796.zip -d android-sdk
sudo mv android-sdk /opt/
export ANDROID_SDK_ROOT=/opt/android-sdk
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
/*====================================================================================================================================* | |
ImportJSON by Trevor Lohrbeer (@FastFedora) | |
==================================================================================================================================== | |
Version: 1.2.1 | |
Project Page: http://blog.fastfedora.com/projects/import-json | |
Copyright: (c) 2012-2013 by Trevor Lohrbeer | |
License: GNU General Public License, version 3 (GPL-3.0) | |
http://www.opensource.org/licenses/gpl-3.0.html | |
------------------------------------------------------------------------------------------------------------------------------------ | |
A library for importing JSON feeds into Google spreadsheets. Functions include: |
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 StreamedText() { | |
const [text, setText] = React.useState(""); | |
React.useEffect(() => { getStream() }, []); | |
function getStream() { | |
// Fetch the stream | |
const stream = await fetch('/api/answer', { method: 'POST', body: JSON.stringify({ query } }) }) | |
const data = stream.body; | |
if (!data) return; |
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
/** | |
* Usage: | |
* | |
* export const config = { | |
* runtime: "edge", | |
* }; | |
* | |
* const stream = await streamFromResponse(await openai.complete({ | |
* model: 'gpt-3.5-turbo', | |
* prompt: 'this is a test', |
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 flattenObjectToMongoDbFormat = (obj, ancestors = []) => { | |
/** | |
* When you want to update a MongoDB document, without overriding | |
* nested fields that are not specified, you need to specify the | |
* nested fields in the format: | |
* `$set: { "parent.nested.key": "value" }` | |
* | |
* This method takes a nested object (usually from an incoming API | |
* request) and converts it to the nested format. | |
*/ |
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
export const flattenObjectToMongoDbFormat = (obj: any, parent: String = ''): any => { | |
/** | |
* When you want to update a MongoDB document, without overriding | |
* nested fields that are not specified, you need to specify the | |
* nested fields in the format: | |
* `$set: { "parent.nested.key": "value" }` | |
* | |
* This method takes a nested object (usually from an incoming API | |
* request) and converts it to the nested format. | |
*/ |
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
#!/bin/bash | |
##################################################### | |
# Name: Bash CheatSheet for Mac OSX | |
# | |
# A little overlook of the Bash basics | |
# | |
# Usage: | |
# | |
# Author: J. Le Coupanec | |
# Date: 2014/11/04 |
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
/* Submit an email address to ConvertKit using only Javascript */ | |
function submitForm(email) { | |
fetch('https://app.convertkit.com/forms/XXXXXX/subscriptions', { | |
// replace XXXXXX above with your form ID (e.g. 1231234) | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/x-www-form-urlencoded' | |
}, | |
body: `email_address=${email}` | |
}).then((response) => { |
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 elemsIn = (tag, parent) => Array.from(parent.getElementsByTagName(tag)); | |
const speedUp = (v) => v.playbackRate = 2; | |
const videos = elemsIn('video', document); | |
const iframes = elemsIn('iframe', document); | |
videos.forEach(speedUp); | |
iframes.forEach((f) => elemsIn('video', f.contentWindow.document).forEach(speedUp)); |
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
#!/usr/bin/env ruby | |
# 1. Copy the raw text from https://www.corequran.com/ | |
# 2. Run "ruby parse.rb" | |
# 3. Paste the copied text | |
# 4. Press "Ctrl + D" to see the output | |
def parse(str) | |
str | |
.split("\n") |
NewerOlder