time.google.com
time1.google.com
time2.google.com
time3.google.com
# Loosely based on http://www.vistax64.com/powershell/202216-display-image-powershell.html | |
[void][reflection.assembly]::LoadWithPartialName("System.Windows.Forms") | |
$file = (get-item 'C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg') | |
#$file = (get-item "c:\image.jpg") | |
$img = [System.Drawing.Image]::Fromfile($file); | |
# This tip from http://stackoverflow.com/questions/3358372/windows-forms-look-different-in-powershell-and-powershell-ise-why/3359274#3359274 |
#!/usr/bin/env ruby | |
# | |
# Mac OS X webarchive is a binary format of a plist file. You can extract the contents manually: | |
# 1. convert the plist file into XML by "plutil -convert xml1 file.webarchive" | |
# 2. parse the resulted XML file by some XML parser | |
# 3. decode "WebResourceData" by Base64.decode64(data) in each key | |
# 4. save the decoded content into a file indicated by "WebResourceData" | |
# Thankfully, the plist library can take care of annoying steps 2 and 3. | |
# | |
# Preparation: |
Get the value of COMP earned for an address that uses the Compound protocol. This can be done using the Lens contract with JSON RPC or another Smart Contract. If you do an eth_call
with JSON RPC, it is free (no gas costs).
getCompBalanceMetadataExt
method in the Lens contract
https://etherscan.io/address/0xdCbDb7306c6Ff46f77B349188dC18cEd9DF30299#codeconst Compound = require('@compound-finance/compound-js');
const provider = 'https://mainnet.infura.io/v3/' + process.env.infuraApiKey;
const cTokenToGetCompApy = Compound.cUSDC; // Pick an asset
const underlying = cTokenToGetCompApy.slice(1, 10);
const underlyingDecimals = Compound.decimals[underlying];
const Compound = require('@compound-finance/compound-js'); | |
const provider = 'https://mainnet.infura.io/v3/' + process.env.infuraApiKey; | |
// mainnet | |
const CompoundLens = Compound.util.getAddress(Compound.CompoundLens); | |
const LensAbi = Compound.util.getAbi(Compound.CompoundLens); | |
const COMP = Compound.util.getAddress(Compound.COMP); | |
const Comptroller = Compound.util.getAddress(Compound.Comptroller); | |
const me = '0xa0df350d2637096571F7A701CBc1C5fdE30dF76A'; |
Net APY: