Skip to content

Instantly share code, notes, and snippets.

View nikhilsaraf's full-sized avatar
💭
Kelping

Nikhil Saraf nikhilsaraf

💭
Kelping
View GitHub Profile
@nikhilsaraf
nikhilsaraf / Absolution.txt
Created April 11, 2024 00:46
A::B challenge solution
Let’s develop a deeper understanding for a text based problem and solve it for all instances of the problem
Problem:
We have 4 tokens that we want to reduce to their simplest form.
Tokens:
A#
#A
B#
#B
/**
AddressBook is a model for how to store the address or phone number for individuals.
*/
class AddressBook {
private Map<String, String> map;
public AddressBook(Map<String, String> map) {
this.map = map;
}
/**
sample code that gets an address book represented by a map
usage:
map = getAddressBookComplex();
phoneNumber = map.get("Ava"); // (415)-730-xxxx
*/
Map<String, String> getAddressBookComplex() {
Map<String, String> map = new HashMap<>();
map.put("Ava", "(415)-730-xxxx");
map.put("Bob", "(512)-349-xxxx");
@nikhilsaraf
nikhilsaraf / http_handlers.go
Created May 5, 2020 16:24
Handle HTTP requests using Golang
package main
import (
"io/ioutil"
"log"
"net/http"
"github.com/go-chi/chi"
)
@nikhilsaraf
nikhilsaraf / multisig_coordination_proposal.md
Last active October 11, 2018 19:13
Stellar Multisig Coordination using SEP-0007

This proposal allows you to coordinate signatures from multisig enabled accounts using SEP-0007 style payment requests, iff the accounts opt-in to use this protocol. This would need support from wallet developers.

  1. All signers on your multisig account will need to have a Stellar Account associated with their public key. Accounts that want to use this protocol should have a data field multisig_uses_SEP-* to indicate that multisig is enabled for this account using this proposal (the * will be filled in once this is formalized into a SEP).
  2. Signers will have a data field, ex: multisig_coordinator that specifies a domain (example: mymultisigservice.com). The domain (mymultisigservice.com) will have a stellar.toml file that contains a field MULTISIG_ENDPOINT that lists an endpoint like so: https://mymultisigservice.com/multisig. This follows from [SEP-0001](https://github.com/stellar/stellar-protocol/blob/master/e
@nikhilsaraf
nikhilsaraf / sign_data.go
Last active May 24, 2021 17:15
Stellar URI Scheme Request Generation and Signing
/*
Copyright 2018 Lightyear.io
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software

Keybase proof

I hereby claim:

  • I am nikhilsaraf on github.
  • I am nikhilsaraf (https://keybase.io/nikhilsaraf) on keybase.
  • I have a public key ASB9RKvRGN6jb24ZpoDQHj00bpyW2mMErQyE4xNmdsDqgQo

To claim this, I am signing this object: