Skip to content

Instantly share code, notes, and snippets.

View nazariyv's full-sized avatar
🔭
You study mathematics because it is the poetry of the universe

naz nazariyv

🔭
You study mathematics because it is the poetry of the universe
View GitHub Profile
{"version":"0.1.0","name":"pump","instructions":[{"name":"initialize","docs":["Creates the global state."],"accounts":[{"name":"global","isMut":true,"isSigner":false},{"name":"user","isMut":true,"isSigner":true},{"name":"systemProgram","isMut":false,"isSigner":false}],"args":[]},{"name":"setParams","docs":["Sets the global state parameters."],"accounts":[{"name":"global","isMut":true,"isSigner":false},{"name":"user","isMut":true,"isSigner":true},{"name":"systemProgram","isMut":false,"isSigner":false},{"name":"eventAuthority","isMut":false,"isSigner":false},{"name":"program","isMut":false,"isSigner":false}],"args":[{"name":"feeRecipient","type":"publicKey"},{"name":"initialVirtualTokenReserves","type":"u64"},{"name":"initialVirtualSolReserves","type":"u64"},{"name":"initialRealTokenReserves","type":"u64"},{"name":"tokenTotalSupply","type":"u64"},{"name":"feeBasisPoints","type":"u64"}]},{"name":"create","docs":["Creates a new coin and bonding curve."],"accounts":[{"name":"mint","isMut":true,"isSigner":true},{"n
@nazariyv
nazariyv / cursor
Created August 25, 2024 12:53 — forked from swayducky/cursor
This fixes using "cursor" command in WSL
#!/usr/bin/env sh
# LATEST VERSION OF THIS SCRIPT: https://gist.github.com/swayducky/8ba8f2db156c7f445d562cdc12c0ddb4
# FORKED FROM: https://gist.github.com/ddwang/0046da801bcb29d241869d37ad719394
# 1) No longer has a hard-coded COMMIT
# 2) Auto-symlinks a "code" script to avoid wslCode.sh breaking
# HOW TO INSTALL:
# 1) Remove "c:\Users\<USER_NAME>\AppData\Local\Programs\cursor\resources\app\bin" from Windows Environment Settings
# 2) Modify this script with your Windows <USER_NAME> (NOT your WSL username) in the VSCODE_PATH variable
@nazariyv
nazariyv / index.js
Created August 12, 2024 20:14
mass unlike twitter browser script
// Mass Unlikes All Your Likes on a given date
// 1. open your likes tab
// 2. input the dates for which you'd like to unlike tweets
// 3. drop this into browser console and hit Enter
(function() {
const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms));
const targetDates = ['Aug 8', 'Aug 9', 'Aug 10', 'Aug 11']; // Add or remove dates as needed
function isElementInViewport(el) {
@nazariyv
nazariyv / gist:9d8725ac1cd43872b8ac28ad90a0fffc
Last active June 9, 2024 15:07
creating-ubuntu-live-server
1/ install ubuntu live server (skip docker here and manually post-install (during ubuntu install it will use snap socker and it's utter shit and will cause you headaches), openssh)
2/ set static ip (/etc/netplan/static.yaml):
network:
version: 2
renderer: networkd
ethernets:
<your-interface>:
addresses:
<your-local-static-ip>
@nazariyv
nazariyv / generate_private_key.py
Created July 11, 2023 10:23
throw away ethereum private key
import random
def int_to_privkey(n):
hex_n = hex(n)[2:] # convert to hexadecimal and strip the "0x" prefix
return hex_n.rjust(64, '0') # pad with zeros to the left until it's 64 characters long
int_to_privkey(random.randing(0, 2 ** 256 - 1))
Two pointers: one input, opposite ends
```python3
def fn(arr):
left = ans = 0
right = len(arr) - 1
while left < right:
# do some logic here with left and right
if CONDITION:
@nazariyv
nazariyv / number_to_base.py
Created November 26, 2022 18:22
Converts number n to base b
def number_to_base(n, b):
if n == 0:
return [0]
digits = []
while n:
digits.append(int(n % b))
n //= b
return digits[::-1]
@nazariyv
nazariyv / refund_bids.py
Created April 23, 2022 16:39
Off-chain refund bids script
from typing import Dict, Tuple
from brownie import accounts, chain
from dataclasses import dataclass
# ! 1. losing threshold to be set manually here
# ! 2. bids to be set manually here
# ! 3. set the account to rkl refunder account in main
# if the bid is below this value, it has lost the auction
# it is possible that there may be two bids for the same
@nazariyv
nazariyv / decorator.py
Created October 6, 2021 19:38 — forked from jaantollander/decorator.py
Template for Python decorator function and class
import functools
def decorator(function):
"""A general decorator function"""
@functools.wraps(function)
def wrapper(*args, **kwargs):
# Write decorator function logic here
# Before function call
@nazariyv
nazariyv / linux-cron-tips.txt
Created September 30, 2021 12:02
Linux - Useful for Cron work
to read the logs that cron produced due to running something: cat /var/mail/$USER
to read the logs of when and if cron launched jobs: sudo cat /var/log/cron
to restart the cron service: sudo systemctl restart crond