Skip to content

Instantly share code, notes, and snippets.

View Alexintosh's full-sized avatar
🧑‍🍳
Baking

Alessio Delmonti Alexintosh

🧑‍🍳
Baking
View GitHub Profile
@levelsio
levelsio / gist:5bc87fd1b1ffbf4a705047bebd9b4790
Last active July 24, 2024 12:04
Secret of Monkey Island: Amsterdam (by @levelsio) or how to create your own ChatGPT image+text-based adventure game
# 2023-11-27 MIT LICENSE
Here's the open source version of my ChatGPT game MonkeyIslandAmsterdam.com.
It's an unofficial image+text-based adventure game edition of Monkey Island in Amsterdam, my home town.
Please use it however you want. It'd be nice to see more ChatGPT-based games appear from this. If you get inspired by it, please link back to my X https://x.com/levelsio or this Gist so more people can do the same!
Send me your ChatGPT text adventure game on X, I'd love to try it!
@pcaversaccio
pcaversaccio / isqrt.ipynb
Last active April 30, 2023 15:42
Example Jupyter Notebook using https://try.vyperlang.org.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# STEP 1: Load
# Load documents using LangChain's DocumentLoaders
# This is from https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/csv.html
from langchain.document_loaders.csv_loader import CSVLoader
loader = CSVLoader(file_path='./example_data/mlb_teams_2012.csv')
data = loader.load()
export const chaosTestStrings = (): void => {
const textNodes = getAllTextNodes(document.body);
for (const node of textNodes) {
const textNodeLength = node.textContent ? node.textContent.length : 0;
if (node.textContent === null) {
return;
}
if (node.parentElement instanceof Element) {
if (node.parentElement.dataset.originalText === undefined) {
@ruphy
ruphy / GPT3.js
Last active November 2, 2023 23:41
GPT3() function for Google Sheets
// SPDX-License-Identifier: MIT
//
// This code will add a GPT3() function in your Google Sheets
// This code is originally inspired from https://twitter.com/fabianstelzer/status/1572926883179778050
// To use it, insert your API key below, open Google Sheets -> Extensions -> Apps Script -> Copy & Paste this -> Save
//
// Usage: =GPT3(prompt, max_tokens (default=15), model (default=davinci))
// Example usage: =GPT3("Once upon a time,", 1000, "davinci")
var API_KEY = "your-API-key";
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
// Unlike the string type, ShortString is a value type that can be made immutable.
// It supports strings of at most 32 bytes and assumes they don't contain null bytes.
type ShortString is bytes32;
error StringTooLong(string s);
@z0r0z
z0r0z / SquishiGame.sol
Created October 9, 2021 21:38
SushiToken Battle Royale on Polygon
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.9;
/// @notice Minimal ERC-20 token interface.
interface IERC20Minimal {
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
@alexisgauba
alexisgauba / VestingCallOptions.md
Created June 25, 2021 18:53
Vesting Call Options

Vesting Call Options

The following instructions go step-by-step through how to create vesting call options, similar to equity options that startups typically use to incentivize employees.

H/t @Fubuloubu, who approached us about creating these for the Yearn team to potentially use! This allows Yearn or similar projects (on-chain DAOs) to grant vesting options to any contributor.

We'll use YFI call options as an example.

Deploy the call options

@miohtama
miohtama / bigquery.sql
Created January 28, 2021 11:47
How to get the total cost of approve() function calls on Ethereum blockchain
-- Web3.utils.keccak256("approve(address,uint256)").slice(0, 10);
-- '0x095ea7b3'
WITH txdata as (
SELECT tx.hash as txid, cast(tx.receipt_gas_used as numeric) * cast(tx.gas_price as numeric) as cost FROM
bigquery-public-data.crypto_ethereum.transactions as tx
where
tx.input
LIKE "0x095ea7b3%")
SELECT (SUM(cost) / POWER(10, 18)) as eth_cost from txdata;