Skip to content

Instantly share code, notes, and snippets.

View cw2908's full-sized avatar
๐Ÿ™ƒ
---

cw2908

๐Ÿ™ƒ
---
View GitHub Profile
@monokh
monokh / uniswap-sdk-v2-get-price.js
Last active May 12, 2024 02:51
Uniswap V2 SDK Get Price
const { Token, WETH9, CurrencyAmount, TradeType } = require('@uniswap/sdk-core')
const { Route, Trade, Pair } = require('@uniswap/v2-sdk')
const ethers = require('ethers')
;(async () => {
const CHAIN_ID = 1
const daiAddress = '0x6B175474E89094C44Da98b954EedeAC495271d0F'
const tokenA = WETH9[CHAIN_ID]
const tokenB = new Token(CHAIN_ID, daiAddress, 18, 'DAI', 'DAI')
const pairAddress = Pair.getAddress(tokenA, tokenB)
@amolpujari
amolpujari / private_inspector.rb
Created September 13, 2019 07:28
inspect ruby object in private
Object.class_eval do
def private_inspect
memo = {}
self.instance_variables.inject(memo) do |memo, var|
memo[var] = self.instance_variable_get(var).to_s
memo
end
except = [:__, :_, :_ex_, :_pry_, :_out_, :_in_, :_dir_, :_file_]
@AJ-Acevedo
AJ-Acevedo / samanage_GET_MAC.sh
Last active January 11, 2018 16:13
Pull a complete hardware list from Samanage and generate a list of MAC addresses
#!/usr/bin/env bash
# Description: Pull a complete hardware list from Samanage and generate a list of MAC addresses
# syntax: ./samanage_GET_MAC.sh
#
# Author: AJ Acevedo
# License: MIT License
# Version 0.5
# API TOKEN
TOKEN="INSERT YOUR API TOKEN HERE"
@nabucosound
nabucosound / heroku_env_copy.sh
Created December 30, 2013 12:40
Script to copy environment variables from an existing heroku app to another one
#!/bin/bash
# Source: http://blog.nonuby.com/blog/2012/07/05/copying-env-vars-from-one-heroku-app-to-another/
set -e
sourceApp="$1"
targetApp="$2"
while read key value; do