Skip to content

Instantly share code, notes, and snippets.

View mculp's full-sized avatar
🎨
arting

Matt Culpepper mculp

🎨
arting
  • Mississippi
  • 07:34 (UTC -05:00)
  • X @mculppp
View GitHub Profile
@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
@mculp
mculp / oxdao.rb
Created March 9, 2022 05:23
quick script to find most profitable oxdao pools
nonempty_pools = pools.select do |pool|
pool['rewardTokens'].any? &&
pool['totalTvlUsd'].to_i.nonzero? &&
pool['poolPrice'].to_i.nonzero?
end
boosted_pools = nonempty_pools.select do |p|
p['boostOxDao'] > 2.4 &&
p['boostSolidex'] > 1.6 &&
p.dig('poolData', 'price0Usd').nonzero? &&
@mculp
mculp / pre-commit
Last active September 18, 2020 21:48
run rubocop as a git precommit hook
#!/bin/bash
files=$(git status -s | grep -E 'A|M' | awk '{print $2}')
files="$files $(git status -s | grep -E 'R' | awk '{print $4}')"
echo $files | xargs $(which rubocop) --display-cop-names --extra-details --parallel --force-exclusion