Skip to content

Instantly share code, notes, and snippets.

View L-F-Escobar's full-sized avatar
🦄

Luis L-F-Escobar

🦄
View GitHub Profile
require("dotenv").config();
const ethers = require("ethers");
const axios = require('axios').default;
const provider = new ethers.providers.JsonRpcProvider(`https://eth-mainnet.alchemyapi.io/v2/${process.env.NEXT_PUBLIC_ALCHEMY_API_KEY}`);
const alg = new ethers.Contract(
"0x32353A6C91143bfd6C7d363B546e62a9A2489A20",
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"inde
@pgolding
pgolding / example.md
Last active August 25, 2023 16:07
Passing AWS Lambda Function parameters using the ClientContext object in Python

Boto3 documentation for lambda_client.invoke suggests it is possible to pass data via the ClientContext object as a string.

The string is required to be base64 encoded JSON.

To encode such a string, use:

import baseb4
base64.b64encode(b'<string>').decode('utf-8')
@santisbon
santisbon / Update-branch.md
Last active March 21, 2024 15:50
Deploying from #Git branches adds flexibility. Bring your feature branch up to date with master and deploy it to make sure everything works. If everything looks good the branch can be merged. Otherwise, you can deploy your master branch to return production to its stable state.

Updating a feature branch

First we'll update your local master branch. Go to your local project and check out the branch you want to merge into (your local master branch)

$ git checkout master

Fetch the remote, bringing the branches and their commits from the remote repository. You can use the -p, --prune option to delete any remote-tracking references that no longer exist in the remote. Commits to master will be stored in a local branch, remotes/origin/master.

@coingraham
coingraham / readyamlfroms3.py
Last active December 8, 2021 12:07
Python - read yaml from S3
import boto3
bucket = "bucket"
s3_client = boto3.client('s3')
response = s3_client.get_object(Bucket=bucket, Key="filename.yaml")
try:
configfile = yaml.safe_load(response["Body"])
except yaml.YAMLError as exc:
return exc
@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active May 6, 2024 21:40
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@cmatskas
cmatskas / GitDeleteCommands.ps1
Last active September 22, 2022 07:59
Git Delete Branch commands
## Delete a remote branch
$ git push origin --delete <branch> # Git version 1.7.0 or newer
$ git push origin :<branch> # Git versions older than 1.7.0
## Delete a local branch
$ git branch --delete <branch>
$ git branch -d <branch> # Shorter version
$ git branch -D <branch> # Force delete un-merged branches
## Delete a local remote-tracking branch
@shimofuri
shimofuri / imap_monitor
Created December 20, 2012 22:04
Python script for monitoring an IMAP folder
Each existing unread and subsequent new emails after the script is started are
passed as Mail objects to "process_email" function.Function header is provided
but processing implementation is left to the user. Error logs are currently sent
to a rotating log file (in the same directory as the script) and to STDOUT.
Instead of polling or checking the server for new emails every now and then,
IMAP IDLE check is utilized. Ensure that the IMAP server supports IDLE command
and allows at least 5 minutes of idling*** and uses the default ports for this
script to work. Tested to work with Gmail and default installations of MS
Exchange Server.
@ibeex
ibeex / foo.log
Created August 4, 2012 13:46
Flask logging example
A warning occurred (42 apples)
An error occurred