Skip to content

Instantly share code, notes, and snippets.

View mculp's full-sized avatar
🎨
arting

Matt Culpepper mculp

🎨
arting
View GitHub Profile
@mculp
mculp / dump.rb
Last active August 16, 2024 06:08
solana projects by twitter handle
require 'set'
File.write(LONG_ASS_FILE_NAME_WHY_DID_I_NAME_IT_THAT, handles)
handles = Set.new(File.readlines(LONG_ASS_FILE_NAME_WHY_DID_I_NAME_IT_THAT).map(&:strip))
if File.exists?("2.tsv")
handles += Set.new(File.readlines("2.tsv").map(&:strip))
File.delete("2.tsv")
end
@mculp
mculp / quick-api-wrapper-in-ruby.md
Last active June 29, 2024 17:03
quick api wrapper in ruby

How to generate a quick API Wrapper Ruby gem

Generate gem skeleton

$ bundle gem foo-api-wrapper
$ cd foo-api-wrapper

Edit gemspec, add http.rb as dependency

@mculp
mculp / squares_simulator.rb
Created February 6, 2023 03:36
GPT-3 calculation of probability of two scenarios in super bowl squares game with arbitrarily weighted numbers
# This was generated by GPT-3, so fact check it before using it
class SquareSimulator
attr_reader :board_size, :player_squares, :column_weights, :row_weights
def initialize(board_size:, player_squares:, column_weights:, row_weights:)
@board_size = board_size
@player_squares = player_squares
@column_weights = column_weights
@row_weights = row_weights
@mculp
mculp / 0.intro.md
Last active January 19, 2023 07:32
How to learn Rust as a Ruby developer

Intro to Learning Rust as a Ruby developer

Rust is a systems programming language that is designed to be safe, concurrent, and fast. It is similar to C++ in terms of its low-level capabilities, but with a number of features that make it more memory-safe and easier to use. Here is a simple example of a "Hello, World!" program in Rust:

fn main() {
    println!("Hello, World!");
}

This code defines a function called main, which is the entry point of every Rust program. The println! macro is used to print a string to the console. The exclamation mark indicates that this is a macro, as opposed to a function.

@mculp
mculp / io.md
Last active December 31, 2022 02:00
chatgpt input/output system

I want you to act as a modular input-and-output system. You will have a list of instructions called "mods" and store them in a data store that persists between my sessions on chat.openai.com (this current website.)

A message starting with "!mod-add" will add a new mod and "!mod-remove" will remove the mod. Similarly, "!mod-disable" messages will disable a mod and "!mod-enable" messages will enable a previously-disabled mod. "!mod-list" will list all mods and statuses. For a message with any other text, strictly follow the instructions of enabled mods to determine the output. If there are no mods added, only output the text "No mods added."

This is the first input: !mod-list

No mods added.

!mod-add character-count

@mculp
mculp / 1.foreword.md
Last active March 30, 2023 04:51
Codex Generated Ruby Client for its own API

Foreword

Bold + Italics signifies my prompts.

There were only 4 prompts:

  • I typed the first two items in the steps immediately below. It finished the list.

  • I prompted again after the list.

  • I prompted again after the license section.

@mculp
mculp / psqlrc
Last active September 4, 2023 04:46
psqlrc with aliases for index, slow queries, locks, etc
--
-- save this as ~/.psqlrc
--
-- run an alias with :
--
-- e.g. :long_running_queries
\set QUIET 1
-- formatting
@mculp
mculp / oxd_LP.txt
Created March 10, 2022 15:09
0xDAO emissions / rewards
************************ 1. row ************************
boost_solidex: 2.0928076186523006
oxdao_v2_rewards: 35145351973587244
oxdv2_boost: 1.5419483576059234
solid_rewards: 35145351973587244
symbol: vAMM-WFTM/OXD
tvl: 559990.86917331589706084137
************************ 2. row ************************
boost_solidex: 1.6251922186182624
oxdao_v2_rewards: 7491782393110821
@mculp
mculp / solidly-dot-dev-pairs.sh
Last active March 9, 2022 22:04
API for solidly.dev/pairs
curl 'https://api.thegraph.com/subgraphs/name/spartacus-finance/solidly' \
-H 'authority: api.thegraph.com' \
-H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="99", "Google Chrome";v="99"' \
-H 'accept: */*' \
-H 'content-type: application/json' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36' \
-H 'sec-ch-ua-platform: "macOS"' \
-H 'origin: https://solidly.dev' \
-H 'sec-fetch-site: cross-site' \
=> [{:symbol=>"vAMM-USDC/OXD", :reward_rates=>["803461050777566", "897985880280809"], :boost_oxdao=>2.5, :boost_solidex=>1.4918954102869841},
{:symbol=>"vAMM-WFTM/TOMB", :reward_rates=>["74694574843542", "83482171883959"], :boost_oxdao=>2.5, :boost_solidex=>1.530933128008952},
{:symbol=>"vAMM-BIFI/miMATIC", :reward_rates=>["5954162014826", "6654651663629"], :boost_oxdao=>2.5, :boost_solidex=>1.4924574268794457},
{:symbol=>"vAMM-WFTM/RDL", :reward_rates=>["484224024803996", "541191557133878"], :boost_oxdao=>2.5, :boost_solidex=>1.521362300792279},
{:symbol=>"sAMM-SOLIDsex/SOLID", :reward_rates=>["4667989419911", "5013706462294"], :boost_oxdao=>2.5, :boost_solidex=>1.4764777520376702},
{:symbol=>"vAMM-BOO/xBOO", :reward_rates=>["3903744445840575", "4363008498292408"], :boost_oxdao=>2.5, :boost_solidex=>1.5671872486016638},
{:symbol=>"vAMM-IB/WFTM", :reward_rates=>["331958051040", "371011939397"], :boost_oxdao=>2.5, :boost_solidex=>1.7462349371592305},
{:symbol=>"vAMM-YFI/WOOFY", :reward_rates=>["27669065