Skip to content

Instantly share code, notes, and snippets.

View cheekybastard's full-sized avatar

cheekybastard

View GitHub Profile
>>> yswap = Contract.from_explorer('0x45F783CCE6B7FF23B2ab2D70e416cdb7D6055f51')
>>> yusd = Contract.from_explorer('0x5dbcF33D8c2E976c6b560249878e6F1491Bca25c')
>>> ycrv = Contract.from_explorer('0xdF5e0e81Dff6FAF3A7e52BA697820c5e32D806A8')
# coins are 0 = idai, 1 = iusdc, 2 = iusdt, 3 = itusd
# underlying coins are 0 = dai, 1 = usdc, 2 = usdt, 3 = tusd
# this gets us the i-counterparts which also sit in money markets
>>> coins = [Contract.from_explorer(yswap.coins(i)) for i in range(4)]
>>> dec = [10 ** coin.decimals() for coin in coins]
[1000000000000000000, 1000000, 1000000, 1000000000000000000]
from brownie import accounts, chain, Contract, Wei
from eth_abi.packed import encode_abi_packed
user = accounts[0]
weth = Contract('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', owner=user)
dai = '0x6B175474E89094C44Da98b954EedeAC495271d0F'
rai = '0x03ab458634910AaD20eF5f1C8ee96F1D6ac54919'
# https://github.com/Uniswap/uniswap-v3-periphery/blob/main/deploys.md
quoter = Contract('0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6')
@cheekybastard
cheekybastard / EVM_Regex_Decompiler.md
Created December 29, 2022 02:03 — forked from vicnaum/EVM_Regex_Decompiler.md
EVM Regex Decompiler
@cheekybastard
cheekybastard / psql.py
Created December 19, 2013 00:16 — forked from fcurella/psql.py
#!/usr/bin/env python
import select
import time
import psycopg2
import psycopg2.extensions
import sys
def get_cursor():
conn = psycopg2.connect("dbname=pgpubsub")
import urllib2
import re
import sys
from collections import defaultdict
from random import random
"""
PLEASE DO NOT RUN THIS QUOTED CODE FOR THE SAKE OF daemonology's SERVER, IT IS
NOT MY SERVER AND I FEEL BAD FOR ABUSING IT. JUST GET THE RESULTS OF THE
CRAWL HERE: http://pastebin.com/raw.php?i=nqpsnTtW AND SAVE THEM TO "archive.txt"
@cheekybastard
cheekybastard / app.js
Created October 30, 2013 00:19 — forked from auser/app.js
angular.module('myApp', ['ngRoute'])
.provider('Weather', function() {
var apiKey = "";
this.getUrl = function(type, ext) {
return "http://api.wunderground.com/api/" +
this.apiKey + "/" + type + "/q/" +
ext + '.json';
};
# ========================================
# Testing n-gram analysis in ElasticSearch
# ========================================
curl -X DELETE localhost:9200/test
curl -X PUT localhost:9200/test -d '
{
"settings" : {
"index" : {
"analysis" : {
# ========================================
# Testing n-gram analysis in ElasticSearch
# ========================================
curl -X DELETE localhost:9200/ngram_test
curl -X PUT localhost:9200/ngram_test -d '
{
"settings" : {
"index" : {
"analysis" : {

Django request flow

-------------------------------                         ------------------ Django --------------------
| Browser: GET /udo/contact/2 |    === wsgi/fcgi ===>   | 1. Asks OS for DJANGO_SETTINGS_MODULE      |
-------------------------------                         | 2. Build Request (from wsgi/fcgi callback) |
                                                        | 3. Get settings.ROOT_URLCONF module        |
                                                        | 4. Resolve URL/view from request.path      | # url(r'^udo/contact/(?P<id>\w+)', view, name='url-identifier')
                                                        | 5. Apply request middlewares               | # settings.MIDDLEWARE_CLASSES
Use extractDocs.py to parse and index the StackOverflow posts.xml file into an existing index.
Usage: extractDocs.py [options] file
Options:
-h, --help show this help message and exit
-s SERVER, --server=SERVER
ElasticSearch Server
-i INDEX, --index=INDEX
Index name to use