Skip to content

Instantly share code, notes, and snippets.

View marianogappa's full-sized avatar

Mariano Gappa marianogappa

View GitHub Profile
@marianogappa
marianogappa / query.sql
Created September 4, 2018 01:55
Big Query SQL to get how many go files are main package vs non-main package on Github
SELECT
IF(package_line = 'main', 'main', 'non_main') AS is_main, COUNT(1) AS count, LEFT(GROUP_CONCAT(UNIQUE(package_line)), 100) AS package_names
FROM (
SELECT
REGEXP_EXTRACT(content, r'package\s+([^\s]+)\s') AS package_line
FROM
(
SELECT
id,
content
@marianogappa
marianogappa / uniswap_price_alert.sh
Created March 5, 2021 20:27
Uniswap price alert
while sleep 60; do if [[ $(curl -s "https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2" -d'{"query": "{tokenDayDatas(first: 1, orderBy: date, orderDirection: desc, where: { token: \"0xf7413489c474ca4399eee604716c72879eea3615\"}) { priceUSD } }"}' | jq -r '.data.tokenDayDatas[0].priceUSD' | tee /dev/tty | sed 's/$/ <= 1.2/' | bc) -eq "1" ]]; then say "buy APYS now"; fi; done