Skip to content

Instantly share code, notes, and snippets.

View gregorynicholas's full-sized avatar
💀
alter.

gregory nicholas gregorynicholas

💀
alter.
View GitHub Profile
@dcts
dcts / scrape_opensea_floor_prices.py
Created October 24, 2021 21:10
Scrape opensea floor prices with python cloudscraper package
import cloudscraper
import json
def filter_typename(dict):
return dict["__typename"] == "AssetQuantityType"
def filter_quantityInEth_exists(dict):
if "quantityInEth" in dict:
return True
else:
@mjackson
mjackson / redirects-in-react-router-v6.md
Last active November 12, 2023 07:32
Notes on handling redirects in React Router v6, including a detailed explanation of how this improves on what we used to do in v4/5

Redirects in React Router v6

An important part of "routing" is handling redirects. Redirects usually happen when you want to preserve an old link and send all the traffic bound for that destination to some new URL so you don't end up with broken links.

The way we recommend handling redirects has changed in React Router v6. This document explains why.

Background

In React Router v4/5 (they have the same API, you can read about why we had to bump the major version here) we had a <Redirect> component that you could use to tell the router when to automatically redirect to another URL. You might have used it like this:

@jamland
jamland / metaplex-candy-machine-help.md
Last active November 26, 2021 17:50
Metaplex Candy Machine help

@metaplex/cli aka Candy Machine Help

Format

  • Folder with files named from 0-1.png
  • JSON file with attributes, format
    • Array with indices matching images
    • Contains: title, description and array of traits ({"display_type":"number","trait_type":"generation","value":2})
@jamland
jamland / update item on candy machine.md
Created September 16, 2021 17:16
Update single item on Metaplex Candy Machine

Q: Say you upload a whole 10k set ahead of time then realize that you messed one up and want to fix the arweave data. Are you hosed, and just have to re-upload everything with a new CM?

A: Go to the temp file created by CM. Find the one is broken. Change arweave URL to new one which is not broken. Mark on-chain: true -> false. Re-run the upload command. Upload command will find the one is missing and reupload it.

@dtmrc
dtmrc / gist:88b40dffb7aff41b7f2358c20c2ad42b
Created September 15, 2021 18:58 — forked from jspacker/gist:5287444
pagerank blogpost super-rough draft

What's Important In My Data? Measuring Influence Using PageRank And Mortar

Networks are everywhere in a data-driven world: social networks, product purchasing networks, supply chain networks, or even biological networks. If your company sells anything to anyone, you will have data that can be modelled as a network, the mathematical term for which is a "graph". Analyzing these graphs can explain how fundamental social, commercial, and physical systems behave, and consequently, how to make money from them (Google revenue in 2012: $50 billion).

The problem is, there is often so much data that it can be hard to tell what one should even try to analyze. One of the first questions to ask then is "which parts of my graph dataset are the most important?"--for example, before one can investigate how Twitter users become influential, one has to find who the most influential Twitter users are in the first place.

A well-known algorithm for finding the most important nodes in a graph is called [Pagerank](http://en.wi

curl http://api.mainnet-beta.solana.com -X POST -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getProgramAccounts",
"params": [
"cndyAnrLdpjq1Ssp1z8xxDsB8dxe7u4HL5Nxi2K5WXZ",
{
"encoding": "jsonParsed",
"filters": [ ]
}
@coinfreakgr
coinfreakgr / attestation.txt
Created September 3, 2021 01:07
Attestation
I contributed to the clr.fund Trusted Setup Multi-Party Ceremony.
The following are my contribution signatures:
Circuit: qvt32
Contributor # 28
Hash: e5b8992c 0825f4c4 1805af39 38813899
1150bdab 251d584a 2b140a2c d8376f73
59857b2c 378459d7 f249c7c2 bd4ec4cd
f9bab802 4deb516e e9069aec 6eec194a
@pitersky
pitersky / wallets_fee_neo3.json
Last active September 17, 2021 00:07
wallets_fee_neo3.json
[
{
"className": "ARKCoin",
"txWebUrl": "https://explorer.ark.io/transaction/",
"feeData": {
"fee": "10000000"
},
"explorers": [
{
"className": "ArkExplorer",
@ajb413
ajb413 / minte-usdc.js
Created October 21, 2020 00:04
Local host fork of mainnet, "steal" some test USDC from a whale (cUSDC contract).
// First run Ganache locally with `cUsdc` address unlocked
const Web3 = require('web3');
const web3 = new Web3('http://127.0.0.1:8545');
const usdcAbi = [{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"authorizer","type":"address"},{"indexed":true,"internalType":"bytes32","name":"nonce","type":"bytes32"}],"name":"AuthorizationCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"authorizer","type":"address"},{"indexed":true,"internalType":"bytes32","name":"nonce","type":"bytes32"}],"name":"AuthorizationUsed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_account","type":"address"}],"name":"Blacklist
@ajb413
ajb413 / net_apy.md
Last active November 28, 2023 06:11
How to calculate the Net APY that is displayed for users on https://app.compound.finance/

Net APY Calculation

  1. Convert all supplied and borrowed asset amounts to a single asset (like USD or ETH).
  2. Calculate the sum of (suppliedAmount * supplyApyAsDecimal - borrowedAmount * borrowApyAsDecimal) for all underlying assets.
  3. If the calculated sum from the previous step is >0 then Net APY = 100 * (sum / totalSuppliedValue). If the calculation from the previous step is <0 then Net APY = 100 * (sum / totalBorrowedValue). If the calculation from the previous step is 0 then Net APY = 0.

Example

Net APY:

  • -7.29%