Skip to content

Instantly share code, notes, and snippets.

View ElliotFriend's full-sized avatar

Elliot Voris ElliotFriend

View GitHub Profile
@ElliotFriend
ElliotFriend / restore-extend-cakewalk-ledger-entries.py
Last active February 13, 2024 19:36
Restore and Extend TTL for all Cakewalk Ledger Entries
import time
import math
from stellar_sdk import xdr, scval, Address, Network, Keypair, SorobanDataBuilder, SorobanServer, TransactionBuilder
from stellar_sdk.soroban_rpc import SendTransactionStatus
# switch this to True if you want all entries to be bumped (the user-submitted stuff).
# otherwise, we'll just bump the contract instance, code, etc.
BUMP_EVERYTHING: bool = False
cakewalk_contract = 'CB4W5563H62YDM27BK5AVBYVPTFXHRPPMCYIMYHT3CWITCZSY34IO2RJ'
@ElliotFriend
ElliotFriend / escrow-example.py
Created January 31, 2024 20:49
Stellar Escrow
# 1. Alice creates the escrow account.
# 2. Alice updates the signers on the escrow account so both Alice and Bob are
# (multi-sig) signers, and adjusts the master key so she no longer has
# exclusive control of the escrow account.
# 3. Alice constructs a tx, whose source is the escrow, with timebounds. This tx
# will be executable in the future, and has Bob as the destination. This tx
# changes the permissions of the escrow account to give Bob full access at
# that time.
# 4. Alice signs it and sends the tx to Bob to review and sign.
# 5. Alice also generates a recovery tx with timebounds. This one says that
@ElliotFriend
ElliotFriend / stellar.js
Created January 16, 2024 15:34
defillama-helpers
const ADDRESSES = require('../coreAssets.json')
const { Account, Keypair, TransactionBuilder, Contract, SorobanRpc, Horizon, xdr } = require("@stellar/stellar-sdk")
const SOROBAN_ENDPOINT = "https://soroban-testnet.stellar.org"
const soroban_server = new SorobanRpc.Server(SOROBAN_ENDPOINT)
const HORIZON_ENDPOINT = "https://horizon.stellar.org"
const horizon_server = new Horizon.Server(HORIZON_ENDPOINT)
const tokenMapping = {
'native': { name: 'stellar' },
@ElliotFriend
ElliotFriend / count_all.py
Last active January 17, 2024 15:11
Count EC repos and contributors for Stellar ecosystem
#!/usr/bin/env python
from count_repos import *
from count_contributors import *
from count_repos_date import *
from github import Auth
from github import Github
from datetime import datetime, timedelta
@ElliotFriend
ElliotFriend / link-testing.py
Last active July 6, 2023 18:00
API Redirects Testing
@ElliotFriend
ElliotFriend / results.md
Created April 28, 2022 04:42
SQ Testnet Assets

SQ Asset Creation on Testnet

Duplicating Accounts and Signers

  • duplicating signers for GBSTM6QKNYQND77XZR3CJN6Y5JALYGNLE5AL5CUB4OYPY2X6C62VPXOI (SQ0101)
  • duplicating signers for GBSUMPWCVF2YPVL6YRCI6EUWOC7MKGATUH2ZMRKXBWHEDW7A2IWBOQ7N (SQ0102)
  • duplicating signers for GBIYXZVXEMPFBKIYLQF7A2TL54YALCIQKZKEIPKL6HJ3OYVF6HAAON7T (SQ0103)
  • duplicating signers for GCATB7XLELFXGGMSO5W6ZWUMA27SQAV7KGR6QJCJ57E6WJPQIR2IJYNR (SQ0104)
  • duplicating signers for GA7WXO3ZUESRMKAY47CYABQZ4VX3DZE27M2JDDB5OUPNE3IU45WWLP3Z (SQ0105)
  • duplicating signers for GA7AUESLEP4NOFZDROK6WO5Y7A3QLLWFOYVWN7NA2JAAXXWHH7I4AQ74 (SQ0106)
@ElliotFriend
ElliotFriend / asset-account-transaction.md
Created March 5, 2022 15:46
SQ0101 Testnet Recreation
AAAAAgAAAABlNnoKbiDR//fMdiS32OpAvBmrJ0C+ioHjsPxq/he1VwACIuAAFAqUAAAAAQAAAAAAAAAAAAAADgAAAAAAAAAKAAAAQDAwaVZCT1J3MEtHZ29BQUFBTlNVaEVVZ0FBQUNBQUFBQWdDQVlBQUFCemVucjBBQUFFSTBsRVFWUllSOFdYUzAAAAABAAAAQGlVVVJUSC8yUGpUS05qMzR5VnBrbGpqMFZFNzFaQ2xqMG16YkFpaUZwVlZMdElLSUtpUlZEUW9vaWlJQmRGMFgAAAAAAAAACgAAAEAwMU1SdFZDVG1pa3JpUkJhOUNBcFd2UW1OWVhSbVJ6TkdXMitPSGU4TS9kN3ptY1IzbzErZDg0OTUzZis1OXo3AAAAAQAAAEAzYzlXTHRmS0QxR05zUmgrM0lOTkRsVExPVlh2eGlJK0JnSnprZ0RTbG0rbUFLdUxmS2pPSFdZMnU3empURzB2AAAAAAAAAAoAAABAMDI5ZjVtdjkvcnQ2TzU4NnVwYlhmNEZHeURja0F1OEJ4Z2hvMFA2N0hldjFHeDZQU3NxWllDcXlOeGtQMGYyZwAAAAEAAABAMGhOQUJxU3dwZW1SVk5UWmRJa3FWU2ZZOUVVbmJCaEJzaWhKaWtLWUE2dUtYSUJrWnFDRzVtQ0dBbCtHQlhOOAAAAAAAAAAKAAAAQDAzWVhGakJmNHY5R29Ib1F1Z0M4NFVUcDFVNTVRSEpLZzJ3elFaQ3R1akVqdDZacGQwR203TVhnMTM2Y1p3RGIAAAABAAAAQHB1eXhEQ0gyZ3dhQVoxODgwSWw1N2p5Tm1tTHdnK0VoTkRWY1JtbUpEM09Yck1ZSmo5MFVvaTNhaDQ2Y0lvVUsAAAAAAAAACgAAAEAwNEdnREtub0tMZzRPb016OFJ0QU93b2JSa0dzNTJ5R2oxZjlKVmdnS0xneUM0Q3BZQWFIRm5QSTQxK1JOQmRUAAAAAQAAAEB6WU80eW14a3NqUHRNQU5IR3hocFRJWmtv
# what initially failed
n = 63
chunks = [jwt_token[i:i+n] for i in range(0, len(jwt_token), n)]
i = 0
jwt_dict = {}
while chunks:
index_data = f"{i:02d}"
key = index_data + chunks.pop(0)
last_char = key[-1]
key = key.rstrip(key[-1])
@ElliotFriend
ElliotFriend / grow-unzip-files.ps1
Last active July 31, 2019 20:47
I subscribe to Grow Curriculum (https://growcurriculum.org). I downloaded all the files they had available, but didn't want to manually extract, move, rename, etc. So, this file came into existence.
$growDestination = "C:\Users\evoris\Grow Curriculum\2019-2020\"
$growDirectory = "C:\Users\evoris\Grow Curriculum\"
$hashPatterns = @{
"PLAN" = "01 Planning"
"CURR" = "02 Curriculum"
"DISC" = "03 Discipleship"
"EVEN" = "04 Events"
"VOLU" = "05 Volunteers"
"PARE" = "06 Parents"
"GAME" = "07 Games"
@ElliotFriend
ElliotFriend / image-processing.py
Last active July 31, 2019 20:47
I subscribe to Grow Curriculum (https://growcurriculum.org), and they recently released (most) of the stuff for the upcoming school year. I didn't want to scale all the images manually, and created the TripleHead2Go collages myself. So, this script came into existence.
import sys
import os
import glob
from os import path
from PIL import Image
glob_pattern = 'C:/Users/evoris/Grow Curriculum/2019-2020/02 Curriculum/**/Graphics & Video/Horizontal/'
for graphics_dir in glob.iglob(glob_pattern, recursive=True):