Skip to content

Instantly share code, notes, and snippets.

View NotoriousPyro's full-sized avatar

NotoriousPyro

View GitHub Profile
@NotoriousPyro
NotoriousPyro / config.yaml
Created April 20, 2024 21:18
Example arb pairs config
pairs: # doesn't work well unless there is sufficient liquidity and the input token exists to swap
# FIAT
# NAME MARKETS LIST LAST UPDATE
- EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v # USDC 29.21k strict 2024-04-17
- Ez2zVjw85tZan1ycnJ5PywNNxR6Gm4jbXQtZKyQNu3Lv # fUSDC 11 strict 2024-04-17
- Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB # USDT 2.78k strict 2024-04-17
- USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX # USDH 169 strict 2024-04-17
- Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS # PAI 54 strict 2024-04-17
#- A9mUU4qviSctJVPJdBJWkb28deg915LYJKrzQ19ji3FM # USDCet 19 strict 2024-04-17
#- Dn4noZ5jgGfkntzcQSUZ8czkreiZ1ForXYoV2H8Dm7S1 # USDTet 8 strict 2024-04-17
@NotoriousPyro
NotoriousPyro / web3js-typescript-retry-fetcher.ts
Created April 18, 2024 10:36
Example TypeScript web3.js with retry fetcher
import { Agent } from "https";
import * as nodeFetch from 'node-fetch';
import fetch from 'fetch-retry'
const _fetch = fetch(nodeFetch.default);
type FetchFn = typeof nodeFetch.default;
type Fetcher = (...args: Parameters<FetchFn>) => ReturnType<FetchFn>;
const RetryFetcher: Fetcher = (...args: Parameters<FetchFn>): ReturnType<FetchFn> => {
const [url, init] = args;
return _fetch(url, {
@NotoriousPyro
NotoriousPyro / anchor-errors-example.ts
Created April 17, 2024 16:36
Error handling with Anchor
try {
const signature = await connection.sendTransaction(tx, {
minContextSlot: blockAndContextInfoManager.minContextSlot,
maxRetries: 3,
skipPreflight: false
});
await confirmTransaction(signature).then(
async => {
if (!knownSwapInstructions.has(routeHash)) {
knownSwapInstructions.set(routeHash, swapInfo);
@NotoriousPyro
NotoriousPyro / asynclogger.ts
Last active April 16, 2024 20:35
Asynchonrous Promise-based logger
// By Pyro @ www.sexonsol.com
import { Console } from "node:console";
/** Asynchronous Promise-based logger */
export default class Logger extends Console {
public name: string;
constructor(name: string) {
super({
stdout: process.stdout,
stderr: process.stderr,
@NotoriousPyro
NotoriousPyro / jupiter-pricemgr.tests.ts
Last active April 2, 2024 03:21
Tests for a class implementing Jupiter's QuoteResponse for profitable quotes. Here is the test, you must implement the class... good luck!
// By Pyro @ www.sexonsol.com
// Price class, basic types and interface for PriceManager provided for you:
import { QuoteResponse } from '@jup-ag/api';
import { BigNumber } from 'bignumber.js';
enum WellKnownTokenMint {
USDC = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
USDCet = "A9mUU4qviSctJVPJdBJWkb28deg915LYJKrzQ19ji3FM",
@NotoriousPyro
NotoriousPyro / connection-manager.ts
Created March 15, 2024 21:31
ConnectionManager Solana class for SexBot
import {
Instruction,
SwapInstructionsResponse
} from "@jup-ag/api";
import {
AddressLookupTableAccount,
ComputeBudgetProgram,
Connection,
Keypair,
PublicKey,
@NotoriousPyro
NotoriousPyro / Cardano-topology-builder.ps1
Last active February 24, 2021 21:55
Builds a topology for use with cardano-node. Set your own block producing relays inside the $newRelays object. Only looks for relays with addresses like *relays* but you can easily customise it. Creates a file called mainnet-topology.json
$relays = Invoke-WebRequest -Uri https://explorer.mainnet.cardano.org/relays/topology.json | ConvertFrom-Json
$relays2 = $relays.Producers | Where-Object {
$_.addr -like '*relays*'
} | Sort-Object { $_.addr -eq 'relays-new.cardano-mainnet.iohk.io' } -Descending
$newRelays = @{
"Producers" = [Collections.ArrayList]@(
@{
"addr" = "127.0.0.1"
@NotoriousPyro
NotoriousPyro / bitfinex.css
Created October 29, 2020 23:50
Bitfinex Stylebot Settings (for larger screens)
#sidebar-widget div.custom-scrollbar.custom-scrollbar {
width: 100;
height: 990px;
padding: 0px 0px 30px;
}
div.tickerlist__container {
height: 1000px;
}
@NotoriousPyro
NotoriousPyro / transmission_removecompleted.ps1
Created September 18, 2019 00:48
Transmission RPC to PowerShell Object calls example. Removes torrents which are completed. I may make this into a tool when I get more time.
$transmission = Join-Path "C:\Program Files\Transmission" transmission-remote.exe
$server = "127.0.0.1:9091"
function GetTorrentObjectList {
param (
$TorrentList
)
$torrents = [Collections.ArrayList]@()
foreach ($torrent in $TorrentList[1..($TorrentList.Count - 2)]) {
@NotoriousPyro
NotoriousPyro / OutlookAutostartAndMinimise.ps1
Last active March 19, 2023 11:13
Automatically finds, runs and places Outlook into the system tray.
<#
.Synopsis
Automatically finds, runs and places Outlook into the system tray.
.Description
Automatically finds, runs and places Outlook into the system tray.
By default, Outlook will start full-screen even when you have the option to minimize tray enabled and start the app as minimized.