Skip to content

Instantly share code, notes, and snippets.

View arilotter's full-sized avatar

Ari Lotter arilotter

View GitHub Profile
@arilotter
arilotter / garnix-deployment-comment.yml
Last active January 17, 2025 00:03
a github workflow to add a link to garnix deployments to PRs
name: Update Deployment Comment
on:
check_suite:
types: [completed]
jobs:
update-comment:
runs-on: ubuntu-latest
from PIL import Image
import numpy as np
import scipy as sp
import os
# Dictionary of known images
KNOWN_IMAGES = {
"0": "out/0.png",
"1": "out/1.png",
"2": "out/2.png",
const minutes = Array.from({length: 60}, (_,i) => i)
const seconds = Array.from({length: 60}, (_,i) => i)
const hours = [0, 1]
const hms = hours.flatMap(h => minutes.flatMap(m => seconds.map(s => [h,m,s])))
const noZeroLeading = hms.map(([h,m,s]) => {
const hh = h == 0 ? '' : `${h}:`
const mm = (h == 0 && m == 0) ? '' : (`${m}`.padStart(h > 0 ? 2 : 1, '0') + ':')
const ss = `${s}`.padStart(m > 0 ? 2 : 1, '0')
return hh+mm+ss
use asynchronous_codec::{Framed, LengthCodec};
use futures::future::BoxFuture;
use futures::{AsyncRead, AsyncWrite, SinkExt, StreamExt};
use libp2p::core::{Multiaddr, UpgradeInfo};
use libp2p::swarm::{
ConnectionHandler, ConnectionHandlerEvent, ConnectionId, FromSwarm, KeepAlive,
NetworkBehaviour, NotifyHandler, PollParameters, SubstreamProtocol, THandlerInEvent, ToSwarm,
};
use libp2p::{InboundUpgrade, OutboundUpgrade, PeerId};
use log::{error, info, warn};
@arilotter
arilotter / beepy-drivers.nix
Created August 27, 2023 03:39
beepy nix demo
{ pkgs, ... }:
let
kernel = pkgs.rpi-kernels.latest.kernel;
sharp-drm-src = pkgs.fetchFromGitHub {
owner = "ardangelo";
repo = "sharp-drm-driver";
rev = "8bdc22653f0555b286c014dbb95bc8064f9693c4";
sha256 = "sha256-eRj74G3SNwHgMqF9KYfCGLfaf2g+EZSdpIdnKW+FPwI=";
};
sharpDriver = pkgs.stdenv.mkDerivation rec {
mkdir -p ~/test-haptics-project
cd ~/test-haptics-project
pnpm init
pnpm i @haptix/[email protected]
cat <<EOF > index.mjs
import {
Actuation,
FeedbackPattern,
PerformanceTime,
internalApiPerform,
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/master";
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, ... }@inputs: inputs.utils.lib.eachSystem [ "aarch64-darwin" ]
(system:
let
{"secrets":[{"secret":{"originalDeck":[],"filledDeck":[],"filledDeckInstances":[],"singletonCardsPosessed":["Dummy","Hero","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","60","61","62","63","64","65","66","67","68","69","70","71","72","73","74","75","76","77","78","79","80","81","82","83","84","85","86","87","88","89","90","91","92","93","94","95","96","97","98","99","100","101","102","103","104","105","106","107","108","109","110","111","112","113","114","115","116","117","118","119","120","121","122","123","124","125","126","127","128","129","130","131","132","133","134","1000","1001","1002","1003","1004","1005","1006","1007","1008","1009","1010","1011","1012","1013","1014","1015","1016","1017","1018","1019","1020","1021","1022","1023","1024","1025","1026","1027","1028","1
@arilotter
arilotter / App.tsx
Created September 28, 2022 16:36
Sequence Rainbowkit Connector
import {
ConnectButton,
connectorsForWallets,
RainbowKitProvider,
wallet,
} from '@rainbow-me/rainbowkit';
import { WagmiConfig } from 'wagmi';
import { chain, configureChains, createClient } from 'wagmi';
import { alchemyProvider } from 'wagmi/providers/alchemy';
import "@rainbow-me/rainbowkit/styles.css";
@arilotter
arilotter / sequence-connector.ts
Created August 18, 2022 18:35
sequence connector (not fully implemented)
import { sequence } from '0xsequence'
import { mainnetNetworks, testnetNetworks } from '@0xsequence/network'
import type { ConnectOptions, ProviderConfig, Web3Provider } from '@0xsequence/provider'
import { Wallet } from '@0xsequence/provider'
import { Chain } from '@rainbow-me/rainbowkit'
import { Connector, ConnectorData, ConnectorNotFoundError, UserRejectedRequestError } from 'wagmi'
interface Options {
provider?: Partial<ProviderConfig>
connect?: ConnectOptions