Skip to content

Instantly share code, notes, and snippets.

View abrkn's full-sized avatar

Andreas Brekken abrkn

View GitHub Profile
@abrkn
abrkn / TOOLS.md
Created February 2, 2026 10:42
OpenClaw X11 tools

xdotool / X11 Access

Real mouse/keyboard automation via xdotool. Useful for bypassing bot detection that blocks CDP clicks.

Setup:

  • Browser runs X server on display :1 with socat forwarding to TCP 6001
  • Agent and browser containers share desk-net Docker network
  • Browser hostname: desk-browser (IP fallback: 172.18.0.2)

Usage:

@abrkn
abrkn / hyperliquid-round.rs
Created April 8, 2025 08:18
Hyperliquid rounding
const PRICE_MAX_SD: u32 = 5;
const PRICE_MAX_DP_PERPS: u32 = 6;
const PRICE_MAX_DP_SPOT: u32 = 8;
/// Rounds the price to the max significant digits or max decimal places
/// See https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/tick-and-lot-size
///
/// The `sz_decimals` is fetched from the meta info endpoint.
///
#!/usr/bin/env bash
#
# Run database migrations with the power of bash
#
set -eu -o pipefail
cd "$(dirname "$0")/.."
if [ "$#" -lt 2 ]; then
1>&2 echo "Usage: $0 postgres://url/db <migration dir>"
exit 1
@abrkn
abrkn / drainTezosAccount.ts
Created July 4, 2020 11:24
Move the remaining balance of a Tezos account to the specified destination
import * as Conseil from 'conseiljs';
import { SoftSigner } from 'conseiljs-softsigner';
import { ns } from '@sideshift/shared';
import {
initializeConseil,
TezosRpcClient,
getTezosKeyStoreFromSecret,
createLogger,
} from '@sideshift/shared-node';
@abrkn
abrkn / demo.ts
Created May 1, 2020 13:07
Whitelist GraphQL introspection types returned by apollo-server
import { middleware as whitelistMiddleware } from './utils/introspecton-whitelist';
import { whitelist as introspectionWhitelist } from './utils/introspecton-whitelist/whitelist';
// Your express app
// Whitelist GraphQL introspection responses
app.use(whitelistMiddleware(introspectionWhitelist));
// Apollo middleware must be below whitelisting middleware
@abrkn
abrkn / heroku-log-pino-pretty.sh
Created April 23, 2020 05:35
Print Heroku logs with pino-pretty
heroku logs -a YOUR_APP_NAME -t | sed 's/[^{]*//' | npx pino-pretty
import pMap from 'p-map';
import pRetry from 'p-retry';
import { safePromise } from 'safep';
import { chain, values, chunk, flatten } from 'lodash';
import { fromEnv as configFromEnv, SlpDepositConfig } from './config';
import { slpTokens } from '../shared/slp-tokens';
import { runWorkerUntilShutdown } from '../shared/utils-node';
import { getBitcoinRpc } from '../shared/rpcs';
import {
toBchAddress,
Authorize linking the domain name sideshift.ai to the Liquid asset d5a8a7af573c0bfa59584a0553f8899dfbcde9f7d839db85d187909fb70e2876

SideShift AI

hmm

import { fromEnv as configFromEnv } from './config';
import { getRpc } from '../shared/rpcs';
import { n, runWorkerUntilShutdown } from '../shared/utils';
import { createDeposit, getConnection, Deposit, Quote } from '../shared/orm';
import { safePromise } from 'safep';
import { AxiosError } from 'axios';
const config = configFromEnv();
const depositMethod = config.depositMethod!;
const { node, asset } = depositMethod!;