Skip to content

Instantly share code, notes, and snippets.

View jmlon's full-sized avatar

Jorge M. Londoño jmlon

  • UPB
  • Medellín, Colombia
  • X @jmlon
View GitHub Profile
/**
* Dereference object attributes from a string.
*
* Access nested object attributes using a string.
*
* @link https://gist.github.com/jmlon/e0fcfdd79233ac4ec3c041cc31370bd2
* @author Jorge M. Londoño
* @since 1.0.0
*/
'use strict';
# pip install mysql-connector-python
import threading
import time
import mysql.connector
HOST = 'localhost'
USER = 'root'
PASSWORD = 'my-secret-pw'
SLEEP = 2
import smtplib
import argparse
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
# from email.header import Header
from configparser import ConfigParser
SERVER="email-smtp.us-east-1.amazonaws.com"
@jmlon
jmlon / TransferSol.tsx
Created January 14, 2022 20:13
Example illustrating the transfer of SOL between accounts
import { clusterApiUrl, Connection, PublicKey, RpcResponseAndContext, SignatureResult, SystemProgram, Transaction } from '@solana/web3.js';
import { FC, useEffect, useRef, useState } from 'react';
import { PhantomProvider } from './ConnectWallet';
interface ITransferSolProps {
provider: PhantomProvider;
}
const network = "devnet";
@jmlon
jmlon / AirDrop.tsx
Last active June 29, 2022 10:32
An example React+Typescript component for requesting an Airdrop in the Solana network
import { Connection, PublicKey, clusterApiUrl, RpcResponseAndContext, SignatureResult } from "@solana/web3.js";
import { FC, useEffect, useRef, useState } from "react";
interface AirdropProps {
pubkey: PublicKey;
}
const network = "devnet";
const Airdrop: FC<AirdropProps> = ({pubkey}) => {
@jmlon
jmlon / Connect2Phantom.tsx
Last active May 19, 2023 20:02
Example connection to the Phantom wallet for the solana_part1 tutorial
import { FC, useEffect, useState } from "react";
import { Connection, PublicKey, clusterApiUrl } from "@solana/web3.js";
type PhantomEvent = "disconnect" | "connect" | "accountChanged";
interface ConnectOpts {
onlyIfTrusted: boolean;
}
@jmlon
jmlon / App.tsx
Created January 6, 2022 00:01
Main App component from solana_part1 example
import React from 'react';
import './App.css';
import Connect2Phantom from './components/Connect2Phantom';
function App() {
return (
<div className="App">
<header className="App-header">
<h1>Solana Examples</h1>
<hr className="fullWidth" />
package edu.upb.estalg.busqueda.movies;
import java.util.ArrayList;
import edu.princeton.cs.algs4.Bag;
import edu.princeton.cs.algs4.RedBlackBST;
import edu.princeton.cs.algs4.SeparateChainingHashST;
import edu.princeton.cs.algs4.StdOut;
public class GeneroPredominante {
# Módulo para funciones matemáticas en los complejos
# https://docs.python.org/3/library/cmath.html
import cmath
# Ingresar complejos en la forma 1+2j
a = complex(input("Ingrese a: "))
b = complex(input("Ingrese b: "))
c = complex(input("Ingrese c: "))
# En este caso no hay precondiciones con respecto a los valores a,b,c
# Tipos de datos
# Definir algunas variables de varios tipos
a = 123
b = 4.56
c = 'Hola Mundo'
d = [ 1,2,3.33 ]
e = ( 1,2,3.33 )
f = { 'a':1, 'b':2 }
g = True