Skip to content

Instantly share code, notes, and snippets.

View evantancy's full-sized avatar

evan evantancy

  • vim
View GitHub Profile
@emonidi
emonidi / tot.ts
Created May 24, 2023 16:17
Langchain.js Naive ToT implementation
import { models } from '../models'
import { LLMChain, SerializedLLMChain } from "langchain/chains";
import { PromptTemplate } from "langchain/prompts";
import {AgentExecutor, BaseSingleActionAgent, StoppingMethod } from "langchain/agents";
import { CallbackManagerForChainRun, Callbacks } from "langchain/callbacks";
import { BaseMultiActionAgent } from "langchain/dist/agents/agent";
import { BaseMemory } from "langchain/memory";
import { AgentAction, AgentFinish, ChainValues } from "langchain/schema";
import { Tool } from "langchain/tools";
@jerryan999
jerryan999 / get-contract-creation-block.go
Last active July 26, 2023 18:17
How to Get Smart Contract Creation Block Time
package main
import (
"context"
"fmt"
"log"
"math/big"
"sync"
"github.com/ethereum/go-ethereum/common"
// you must provide the account hex, signature hex and the message wrapped with <Bytes>...</Bytes>
// To get the hex from the account you can do:
// import { u8aToHex, u8aToU8a } from "@polkadot/util";
// const hexPublicKey = u8aToHex(decodeAddress(account.address));
func TestVerifySR25519(t *testing.T) {
const pubhex = "0xf84d048da2ddae2d9d8fd6763f469566e8817a26114f39408de15547f6d47805"
const sighex = "0x48ce2c90e08651adfc8ecef84e916f6d1bb51ebebd16150ee12df247841a5437951ea0f9d632ca165e6ab391532e75e701be6a1caa88c8a6bcca3511f55b4183"
const challenge = "<Bytes>message to sign</Bytes>"
@kf106
kf106 / ropsten-peers.txt
Last active November 21, 2022 07:26
List of active Ropsten peers found as of 30.4.2021
// For information on how to set up a Ropsten miner see https://www.linkedin.com/pulse/how-mine-ropsten-testnet-ether-keir-finlow-bates/
// For test Ropsten visit https://moonborrow.com/
// active Ropsten peer nodes found 15 Oct 2021
["enode://05b558e4f6bb2853c80fbadd669e3e6123ad10ca08e43eccb9abcc50180a55486c8fc9f8b36d85033eca3888849920fb9d29981df85d1c3ffbea504848026716@104.248.75.151:8888", "enode://ddc869dab42ee378d9ea8f3872e0d114b2a0450c2b5e533ce899249c2cf88651bb14e7250b60765d333d3419d82c328effecbf56ddfac2cfb9c19b66682b4a09@52.72.11.115:30303", "enode://deb4a2157ec32c1837a2480d6752fc388f2fd6e9d97650c5e74bd1db11de2c2855ea6c4a62630b2292b6bf46ecc06e35a3e12d63bc145d0b810a3d0d4ea59d13@18.181.27.33:30303", "enode://fe9908781f114f1306d494610478dfa8af913e48612697113b1340133be502a4797c25e319b2609e166d77d0a1382124b5bb7b449cf29c390c4067560fc5fdd7@35.153.104.230:30303", "enode://a534ad8959940358d753e6f9155af0ff39de2e300e8bb1780fad53f3fab6757ae4d3b0e499aec14157b0c56fddeb8227405d8c5976318ed84325521ca8acc5f4@54.157.217.
@andrebrait
andrebrait / keychron_linux.md
Last active June 26, 2024 03:35
Keychron keyboards on Linux + Bluetooth fixes

Here is the best setup (I think so :D) for K-series Keychron keyboards on Linux.

Note: many newer Keychron keyboards use QMK as firmware and most tips here do not apply to them. Maybe the ones related to Bluetooth can be useful, but everything related to Apple's keyboard module (hid_apple) on Linux, won't work. As far as I know, all QMK-based boards use the hid_generic module instead. Examples of QMK-based boards are: Q, Q-Pro, V, K-Pro, etc.

Most of these commands have been tested on Ubuntu 20.04 and should also work on most Debian-based distributions. If a command happens not to work for you, take a look in the comment section.

Make Fn + F-keys work (NOT FOR QMK-BASED BOARDS)

Older Keychron keyboards (those not based on QMK) use the hid_apple driver on Linux, even in the Windows/Android mode, both in Bluetooth and Wired modes.

@YashasSamaga
YashasSamaga / yolov4.py
Last active February 18, 2024 04:03
YOLOv4 on OpenCV DNN
import cv2
import time
CONFIDENCE_THRESHOLD = 0.2
NMS_THRESHOLD = 0.4
COLORS = [(0, 255, 255), (255, 255, 0), (0, 255, 0), (255, 0, 0)]
class_names = []
with open("classes.txt", "r") as f:
class_names = [cname.strip() for cname in f.readlines()]
" Specify a directory for plugins
call plug#begin('~/.vim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'scrooloose/nerdtree'
"Plug 'tsony-tsonev/nerdtree-git-plugin'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
Plug 'ryanoasis/vim-devicons'
Plug 'airblade/vim-gitgutter'
@aanari
aanari / tos_ubuntu.md
Last active December 3, 2020 01:55
ThinkOrSwim on Ubuntu 18.04

ThinkOrSwim on Ubuntu 18.04

  1. Update packages and install the Oracle JDK of Java 8 using a special PPA:
sudo add-apt-repository ppa:ts.sch.gr/ppa
sudo apt-get update
sudo apt-get install oracle-java8-installer
  1. Download the installer from here
-nostdlibinc
-I/home/uchan/osbook/devenv/x86_64-elf/include
-I/home/uchan/osbook/devenv/x86_64-elf/include/c++/v1
-I.
-D__ELF__
-D_LIBCPP_HAS_NO_THREADS
-O2
-Wall
-g
--target=x86_64-elf