Skip to content

Instantly share code, notes, and snippets.

View sedaghatfar's full-sized avatar

Matthew Sedaghatfar sedaghatfar

View GitHub Profile
@sedaghatfar
sedaghatfar / etherrollfunction.py
Created September 25, 2019 18:01
eth roll function
def etherroll(fromBlock,toBlock):
address = '0xa52e014b3f5cc48287c2d483a3e026c32cc76e6d'
topic0 = '0x8dd0b145385d04711e29558ceab40b456976a2b9a7d648cc1bcd416161bf97b9'
apikey = 'yourapikey'
url = f'https://api.etherscan.io/api?module=logs&action=getLogs&fromBlock={fromBlock}&toBlock={toBlock}&address={address}&topic0={topic0}&apikey={apikey}'
request = requests.get(url)
results = request.json()
new = []
i = 0
while i < len(results['result']):
@sedaghatfar
sedaghatfar / SQL_WEEK_II_Answer_key.sql
Last active August 28, 2019 21:32
SQL_WEEK_II_Answer_key
-- Output a count of jobs by the organization name and id
SELECT
jobs.organization_id
,organizations.name
,COUNT(jobs.id) as jobs
FROM jobs
LEFT JOIN organizations ON jobs.organization_id = organizations.id
GROUP BY 1,2
-- Query all columns from the jobs table, and limit to 10 rows
SELECT *
FROM jobs
LIMIT 10;
-- Query all columns with costs above 50
SELECT *
FROM jobs
SELECT *
FROM jobs
LIMIT 10;
SELECT *
FROM jobs
WHERE costs > 50;
SELECT
state_abb
CREATE TABLE Accounts (
Id INT,
Name varchar(50),
Account_type varchar(50),
Created_at timestamp
);
INSERT INTO Accounts
(Id, Name, Account_type, Created_at)
VALUES
@sedaghatfar
sedaghatfar / eng_eth.py
Created December 28, 2017 01:37
eng_eth.py
import os
import tempfile
import time
import numpy as np
import pandas as pd
import talib
from logbook import Logger
from catalyst import run_algorithm
payment <- function(loan, apr, months) {
rate <- 1 + apr / 100 / 12
loan * rate^months * (rate - 1) / (rate^months - 1)
}
amortize <- function(loan, payment, apr, months) {
rate <- 1 + apr / 100 / 12
month <- 0:months
balance <- loan * rate^month - payment * (rate^month - 1) / (rate - 1)
complete <- match(TRUE, balance <= 0)
<?php
/**
* The template for displaying image attachments
*
*
* @package i_spirit
* @since i-spirit 1.0
*/
get_header(); ?>
for i in range(1,101):
s = str(i)
if i % 3 == 0 or i % 5 == 0:
s = " "
if i % 3 == 0:
s = s + "Fizz"
if i % 5 == 0:
s = s + "Buzz"
print (s)
x = int(input("enter an integer: "))
ans = 0
while ans*ans*ans < abs(x):
ans = ans +1
print ("current Guess =", ans)
print ("last guess = ", ans)
print ("ans*ans*ans = ", ans*ans*ans)
if ans*ans*ans == abs(x):