Skip to content

Instantly share code, notes, and snippets.

View m-root's full-sized avatar
💭
I may be slow to respond.

m-root

💭
I may be slow to respond.
View GitHub Profile
@m-root
m-root / extract_data_from_multiple_gifs.py
Last active September 2, 2023 10:53
Extract data from multiple gifs
import os
import rasterio
import pandas as pd
folder_path = "/path/to/your/folder"
all_tiffs = [f for f in os.listdir(folder_path) if f.endswith('.tif') or f.endswith('.tiff')]
master_df = pd.DataFrame()
for tiff_file in all_tiffs:
@m-root
m-root / basisPerpSpotSpread.js
Last active March 25, 2023 04:30
Basis Perp-Spot Spread is a script that fetches and calculates the spread between the perpetual contract price and the spot price of a cryptocurrency on different exchanges. The script uses the Binance and Bybit APIs to fetch the perpetual and spot contract prices respectively, and then calculates the basis as the difference between the two pric…
// Importing Binance and Bybit Node Packages
const {CoinMClient} = require('binance');
const RestClientV5 = require('bybit-api').RestClientV5;
// Set the API keys for the Binance and Bybit APIs
// Set the API keys for the Binance and Bybit APIs
const apiKeyBinance = 'your-binance-api-key';
const apiSecretBinance = 'your-binance-api-secret';
const apiKeyBybit = 'your-bybit-api-key';
const apiSecretBybit = 'your-bybit-api-secret';
@m-root
m-root / async.py
Created July 2, 2022 07:08
Async exaple
import asyncio
async def fetch_data():
print('Start Fetching Data')
await asyncio.sleep(2)
print('Done fetching')
return {'Data' : 1}
async def print_numbers():
for i in range(10):
@m-root
m-root / chain_array_sort.py
Created July 2, 2022 03:46
This is a chain and link array sort for python arrays
arr = [[6, 1], [1, 2], [3, 4], [5, 6], [2, 3], [4, 5]]
def separator(ab, b):
if b.index(ab) == 0:
return b[1]
else:
return b[0]
import time
@m-root
m-root / High-Stakes.sol
Created October 24, 2021 19:40 — forked from gorgos/High-Stakes Roulette Example
Example for a contract for playing high-stakes Roulette on the blockchain
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract BankOwned {
address public bankAddress;
constructor() {
bankAddress = msg.sender;
}

Command line instructions You can also upload existing files from your computer using the instructions below.

Git global setup

git config --global user.name "<user_name>"
git config --global user.email "<user_email>"
@m-root
m-root / primebit-auth-wrapper.py
Created April 14, 2020 18:12
I really had a difficult time trying to come up with the authentication method for Primebit. I wouldn't want anyone else who is a developer to go through the same challenge. All the best. Happy Trading :-)
'''
I really had a difficult time trying to come up with the authentication method for Primebit. I wouldn't want anyone
else who is a developer to go through the same challenge.
All the best. Happy Trading :-)
'''
from typing import Optional, Dict, Any, List
from requests import Request, Session, Response, request, exceptions
import hmac
import time
import bisect
import itertools
class World:
uid = 0
def __init__(self, nodes, lfunc, **kwargs):
d = [
[9, 4, 0, 0],
[0, 6, 0, 0],
[0, 0, 3, 0],
[0, 0, 0, 4]
] # List matrix
f = 0 # initilizing for the matrix columns
g = 3 # The starting point
h = [] # Final Sentence List
@m-root
m-root / logger.py
Created August 16, 2019 08:21
Log File Auto Generator
import sys
from logging.handlers import TimedRotatingFileHandler
import logging
import logging.handlers
from datetime import date
from pathlib import Path
def get_project_root() -> Path:
return Path(__file__).parent.parent