This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function git_numstat_summary() { | |
CURRENT=$(git branch --show-current) | |
FILES=$(git diff --name-only main...HEAD | wc -l) | |
echo "Files changed" | |
echo "$FILES files" | |
echo "Lines changed" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gitsync(){ | |
CURRENT=$(git branch --show-current) | |
if [ -n "$1" ] | |
then | |
echo "Fetching branch $1" | |
git fetch origin $1:$1 | |
echo "Merging $1 into $CURRENT" | |
git merge $1 -m "Merged branch $1 into $CURRENT" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function COINGECKO(input = 'bitcoin', property = 'all', currency = 'usd') { | |
Logger.log(`Search for #> ${input} @prop: ${property} @currency: ${currency}`); | |
const cache = CacheService.getScriptCache(); | |
let coinData = cache.get(input); | |
if(!coinData){ | |
Logger.log('No cached coin data found! Let\'s fetch the api'); | |
const URL = `https://api.coingecko.com/api/v3/coins/markets?vs_currency=${currency}&ids=${input}&price_change_percentage=24h,7d,14d,30d,1y`; | |
try{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
This function is intended to be used as (google app script)[https://developers.google.com/apps-script/guides/sheets/functions#using_a_custom_function] inside google sheets to load the price for a given coin name from coinmarketcap | |
Since google sheet makes exahustive calls to their functions this one has implemented a cache mechanism to prevent calling cooinmarketcap constantly and being banned easily | |
The cache last 30 minutes but can be reseted by passing true as second param to the function in your sheet cell | |
usage: | |
| A1 | A2 | |
| bitcoin | =CRYPTOPRICE(A1) | |
Forced price refresh: |