Skip to content

Instantly share code, notes, and snippets.

View Cooops's full-sized avatar
🏠
Working from home

Coopes Cooops

🏠
Working from home
View GitHub Profile
@Cooops
Cooops / capDetector.js
Created November 16, 2023 04:27
Detecting caps on Lodestar markets
const tokenAddresses = [
"0x5d27cFf80dF09f28534bb37d386D43aA60f88e25", //DPX
"0xD12d43Cdf498e377D3bfa2c6217f05B466E14228", //FRAX
"0xf21Ef887CB667f84B8eC5934C1713A7Ade8c38Cf", //MAGIC
"0xeA0a73c17323d1a9457D722F10E7baB22dc0cB83", //plvGLP
"0x4C9aAed3b8c443b4b634D1A189a5e25C604768dE", //USDC
"0x1ca530f02DD0487cef4943c674342c5aEa08922F", //USDC.e
"0x9365181A7df82a1cC578eAE443EFd89f00dbb643", //USDT
"0xC37896BF3EE5a2c62Cdbd674035069776f721668", //wBTC
"0x4987782da9a63bC3ABace48648B15546D821c720", //DAI
// copied from here: https://github.com/Lodestar-Finance/lodestar-staking/blob/main/scripts/create-handler.js
const tokenAddresses = [
"0x5d27cFf80dF09f28534bb37d386D43aA60f88e25", //DPX
"0xD12d43Cdf498e377D3bfa2c6217f05B466E14228", //FRAX
"0xf21Ef887CB667f84B8eC5934C1713A7Ade8c38Cf", //MAGIC
"0xeA0a73c17323d1a9457D722F10E7baB22dc0cB83", //plvGLP
"0x4C9aAed3b8c443b4b634D1A189a5e25C604768dE", //USDC
"0x1ca530f02DD0487cef4943c674342c5aEa08922F", //USDC.e
"0x9365181A7df82a1cC578eAE443EFd89f00dbb643", //USDT
"Contracts": {
"CompoundLens": "0x5bea0da86173D4787f45DF7Ad2701792EBB3a7dB",
"JumpRateModel_1": "0xB0249679b9e72F90d9f9adEd98DF25425C4675cC",
"JumpRateModel_2": "0x457146F08f35116FEaf2877Da973ee6993128D1e",
"JumpRateModel_3": "0x6ef76Cdb3C11791044fE0D687CE7d07114972A8A",
"JumpRateModel_4": "0x66fE251097338a16b4ed97d57ef5C5F77C5a2d9A",
"JumpRateModel_5": "0xE453e1999A92Af2f02A54Bc984D4ac8b13B828B6",
"StdComptroller": "0x4A8eA74650F488612f212dBF1b2b006566bdfea4",
"PriceFeed": "0xAA6bD451EECAafad22A2cAd75983C0E225F29CbC",
"USDCDelegate": "0x35f9dd0d20193afC5FECd43a2Cf87b98EE9C8A00",
raw data dump
ports.js:265 cTokenAddress 0x724716Eb6677e738e8259891E76849cA58e03767
ports.js:266 exchangeRateResult 200000000000000000000000000
ports.js:267 supplyRateResult 0
ports.js:268 borrowRateResult 9512937595
ports.js:269 reserveFactorResult 0
ports.js:270 totalBorrowsResult 0
ports.js:271 totalReservesResult 0
ports.js:272 totalSupplyResult 0
ports.js:273 totalCashResult 0
@Cooops
Cooops / cb_eng
Last active April 8, 2019 18:49
"""
Asha and Kelly are programming, but Asha practices more than Kelly. Not wanting to fall behind, Kelly resolves to practice more.
They each solve a number of problems in a day. Asha has already solved more problems than Kelly. What is the minimum number of days
it will take for Kelly to have solved more problems than Asha?
For example, if Asha is 5 problems ahead of Kelly and they solve 3 and 5 problems a day, Asha will be ahead by only 3 after the first day,
1 after the second, and Kelly will pass Asha on day 3.
------------------------------------------------------------------------------------------------------------------------------------------
Your task is to write a program which:
- calculates the number of days needed by Kelly to catch up
- return -1 if it's impossible
import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/2011_february_us_airport_traffic.csv')
df.head()
df['text'] = df['airport'] + '' + df['city'] + ', ' + df['state'] + '' + 'Arrivals: ' + df['cnt'].astype(str)
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
from textwrap import dedent as d
import pandas as pd
import plotly.graph_objs as go
import psycopg2
import json
import datetime
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
from textwrap import dedent as d
import pandas as pd
import plotly.graph_objs as go
import psycopg2
import json
@Cooops
Cooops / fetch_catids.py
Created July 22, 2018 23:37
Python script for pulling every CATEGORY_ID from eBay's API.
# For some reason eBay make it surprisingly difficult to find every CATEGORY_ID and as a result I put together this script,
# so hopefully this script helps a few people who were in my position. All you need is requests and xmltodict.
# Cheers -- Cooper.
#! /usr/bin/env python
import xmltodict as xml
import requests
url = 'http://open.api.ebay.com/Shopping?callname=GetCategoryInfo&appid={}&siteid={}&CategoryID={}&version=729&IncludeSelector=ChildCategories'
app_id = 'YOUR-APP-ID-HERE'
print('test')