Skip to content

Instantly share code, notes, and snippets.

View hrik2001's full-sized avatar
😪
Couldn't sleep last night

Shatabarto "Rik" Bhattacharya hrik2001

😪
Couldn't sleep last night
View GitHub Profile
@hrik2001
hrik2001 / linear_regression.py
Created May 10, 2019 17:46
basic linear regression
import matplotlib.pyplot as plt
from sklearn.datasets import make_regression #dataset
import random
X,Y = make_regression(n_features=1, noise=10, n_samples=1000)
plt.scatter(X,Y,s=5 , label = "training")
plt.xlabel('Feature - X')
plt.ylabel('Target - Y')
@hrik2001
hrik2001 / clean.sh
Created November 30, 2019 11:21
a small script written in BASH script to clean Chrome and Firefox cookies for linux
echo "BrowserClean Script by Rik"
echo "================================================================================"
echo "Deleting Chrome cache and cookies";
mkdir ~/.clean;
cp ~/.config/google-chrome/Default/Bookmarks ~/.clean;
rm -rf ~/.config/google-chrome/Default/;
mkdir ~/.config/google-chrome/Default;
cp ~/.clean/Bookmarks ~/.config/google-chrome/Default;
cp ~/.mozilla/firefox/*.default/places.sqlite ~/.clean;
from pynput.keyboard import Controller , Key
from time import sleep , time
import random
k = Controller()
arr = ["randi" , " gay" , "gay boy" , "nigger dick"]
n = input("how many spams?")
n = int(n)
sleep(2)
for i in range(n):
@hrik2001
hrik2001 / pyselector.py
Created October 2, 2020 12:21
Select stuff from list using curses terminal GUI
from curses import *
def selector(a , stri):
'''a poorly written selector CLI curses selector, works for python3'''
for elements in a:
if type(elements) != str:
stdscr.refresh()
endwin()
return -1
import requests
import time
import datetime
import json
def search_pincode(numdays , pincode , min_age_limit = 18):
'''
numdays -- int that makes you look n days into the future
pincode -- put pincode in string
min_age_limit -- put 18 for 18+ (default) , 45 for 45+ and 0 for everyone
@hrik2001
hrik2001 / Product.md
Last active September 11, 2022 14:58
GSoC'22: Personal Recommendation of a track

GSoC'22: Personal Recommendation of a track

See this blog at MetaBrainz Blogs

Hi Everyone!

I am Shatabarto Bhattacharya (also known as riksucks on IRC and hrik2001 on Github). I am an undergraduate student pursuing Information Technology from UIET, Panjab University, Chandigarh, India. This year I participated in Google Summer of Code under MetaBrainz and worked on implementing a feature to send personal recommendation of a track to multiple followers, along with a write up. My mentors for this project were Kartik Ohri (lucifer on IRC) and Nicolas Pelletier (monkey on IRC)

Proposal

For readers, who are not acquianted with ListenBrainz, it is a website where you can integrate multiple listening services and view and manage all your listens at a unified platform. One can not only peruse their own listening habits but also find other interesting listeners and interact with them. Moreover, one can even

▶forge test --match-test testFuzzDistributeTokenMultipleAddressesSuccess -vvvvv
[⠢] Compiling...
[⠊] Compiling 86 files with 0.8.17
[⠘] Solc 0.8.17 finished in 27.91s
Compiler run successful
Running 1 test for test/utils/BatchDistributor.t.sol:BatchDistributorTest
[FAIL. Reason: Assertion failed. Counterexample: calldata=0xcc173d850000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000054a0000000000000000000000001804c8ab1f12e6bbf3894d4083f33e07309d1f3800000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000026a0000000000000000000000000000000000000000000000000000000000000371000000000000000000000000000000000000000000000000000000000065737300000000000000000000000000000000000000000000000000000000000014b800000000000000000000000000000000000000000000000000000000000016a60000000000000000000000000000000000000000000000000
File % Lines % Statements % Branches % Funcs
../../node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol 23.64% (13/55) 22.58% (14/62) 13.64% (3/22) 27.78% (5/18)
../../node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol 0.00% (0/17) 0.00% (0/23) 0.00% (0/10) 0.00% (0/7)
../../node_modules/@openzeppelin/contracts/utils/Address.sol 0.00% (0/26) 0.00% (0/28) 0.00% (0/16) 0.00% (0/13)
../../node_modules/@openzeppelin/contracts/utils/Context.sol
# execute this at v2-deploy directory
import os
import json
path_name = './deployments/polygon'
files = (os.listdir(path_name))
for file_name in files:
if file_name.endswith('.json'):
with open(path_name + '/' + file_name) as f:
d = json.load(f)
print("address of ", file_name, d['address'])
from web3 import Web3
import json
w3 = Web3(Web3.HTTPProvider("https://rpc.mantle.xyz"))
# w3 = Web3(Web3.HTTPProvider("https://rpc.testnet.mantle.xyz"))
# w3 = Web3(Web3.HTTPProvider(f'https://arb-mainnet.g.alchemy.com/v2/L_HXVya-RV6U6SwLHWf1eUdlgwN20J-7'))
with open("abi/TimeswapV2PeripheryNoDexLendGivenPrincipal.json") as f:
abi_lend_given_principal_nodex = json.load(f)["abi"]