Skip to content

Instantly share code, notes, and snippets.

int Solution::lengthOfLongestSubstring(string A) {
size_t longest = 0;
// holds the characters of the current substring
unordered_set<char> currSet;
for (int i = 0; i < A.size(); ++i) {
// if the current character already exists in the substring
if (!currSet.insert(A[i]).second) {
longest = max(longest, currSet.size());
// erase the most senior elements of the set until insertion succeeds
while (!currSet.insert(A[i]).second) {
@mgild
mgild / keybase.md
Created February 24, 2017 14:23
keybase.md

Keybase proof

I hereby claim:

  • I am mgild on github.
  • I am mgild (https://keybase.io/mgild) on keybase.
  • I have a public key whose fingerprint is 6471 1D67 3193 7545 0752 0627 3AD1 25EC 2051 486B

To claim this, I am signing this object:

const queueKeypair = keypairFromFile(
"~/switchboard_accounts_v2/queues/queue_permissionless.json"
);
const accountInfos = await program.provider.connection.getProgramAccounts(
new PublicKey(PID),
{ filters: [{ dataSize: 3851 }] }
);
const accounts: Array<PublicKey> = [];
for (const info of accountInfos) {
try {
const queue = new PublicKey("F8ce7MsckeZAbAGmxjJNetxYXQa9mKr9nnrC3qKubyYy");
const burl = `https://api.raydium.io/coin/price?coins=LARIX`;
const tasks = [
OracleJob.Task.create({
httpTask: OracleJob.HttpTask.create({
url: burl,
method: OracleJob.HttpTask.Method.METHOD_GET,
}),
}),
];
const bufRelayer = await sbv2.BufferRelayerAccount.create(program, {
name: Buffer.from("t1"),
minUpdateDelaySeconds,
queueAccount: new sbv2.OracleQueueAccount({
program,
publicKey: queue,
}),
authority: sbv2.programWallet(program).publicKey,
jobAccount,
});
set nocompatible
filetype off " required
" set rtp+=~/.vim/bundle/Vundle.vim
call plug#begin("~/.vim/plugged")
Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/asyncomplete-lsp.vim'
Plug 'prabirshrestha/vim-lsp'
" let g:lsc_auto_map = v:true
" Send async completion requests.
select
instructions[0].executing_account as pid,
count(*)
from
solana.transactions
where
block_time > (NOW() - interval '7 days')
and arrays_overlap(
account_keys,
array(
class AptosEvent {
constructor(
readonly client: AptosClient,
readonly eventHandlerOwner: HexString,
readonly eventStruct: string,
readonly eventHandlerName: string
) {}
async onTrigger(callback: (e: any) => any) {
// Get the start sequence number in the EVENT STREAM, defaulting to the latest event.
class AptosEvent {
constructor(
readonly client: AptosClient,
readonly eventHandlerOwner: HexString,
readonly eventOwnerStruct: string,
readonly eventHandlerName: string,
readonly pollIntervalMs: number = 1000
) {}
async onTrigger(callback: (e: any) => any) {
import fetch, { Response } from "node-fetch";
async function doQuery(query: string): Promise<any> {
const response = await fetch("https://api.vybenetwork.com/v1/graphql", {
method: "POST",
headers: {
Authorization: "b65fcbef-ead9-4893-86a1-28c12e43b59f",
},
body: JSON.stringify({
query: query,