Skip to content

Instantly share code, notes, and snippets.

@ljchuello
ljchuello / sendBtc.cs
Created September 8, 2019 03:29
problems sending money when the wallet has more than 1 transaction
public bool EnviarTodo(string llavePrivada, string destino, string mensaje)
{
Key privateKey = Key.Parse(llavePrivada);
BitcoinSecret bitcoinPrivateKey = new BitcoinSecret(llavePrivada);
BitcoinAddress address = bitcoinPrivateKey.GetAddress(ScriptPubKeyType.Legacy);
QBitNinjaClient client = new QBitNinjaClient(Network.Main);
uint256 transactionId = uint256.Parse("42119368712db98a8fb75763fd9158848dc37ff5b180413e30a5063113b4aaa1");
GetTransactionResponse transactionResponse = client.GetTransaction(transactionId).Result;
@ljchuello
ljchuello / Email.cs
Created January 17, 2020 22:39
Send email with SMTP 465 in C# (MailKit)
// Leonardo Chuello - ljchuello@gmail.com
using MailKit.Net.Smtp;
using MailKit.Security;
using MimeKit;
namespace Test
{
public class Email
{
@ljchuello
ljchuello / img.css
Created July 22, 2020 02:38
TOP => Código mágico que hace todas las imagenes se vean simétricas <3
.crop-image {
display: block;
height: 300px;
width: 100%;
img {
object-fit: contain;
height: 100%;
width: 100%;
object-position: center;
}
@ljchuello
ljchuello / carta_dinagrafica_txt
Created July 13, 2021 12:17
Envio de la carta dinagrafica por telemetría
{
"CartaDinagrafica": {
"SurfaceCardPosition": [
0.063974,
0.221548,
0.40837,
0.575877,
0.75933,
0.942007,
1.125695,
@ljchuello
ljchuello / cartav2.txt
Last active August 28, 2021 19:33
Ejemplo de envío de carta dinagráfica
curl --location --request POST 'https://dpsos.entecprois.com/api/v1/cartadinagrafica/' \
--header 'Content-Type: application/json' \
--data-raw '{
"CartaDinagrafica": {
"SurfaceCardPosition": [
0.091543,
0.271862,
0.578872,
0.90781,
1.236326,
@ljchuello
ljchuello / CallLambda.cs
Created June 22, 2022 00:54
Ejecuta una función de AWS Lambda desde C#
// Parametro
string parametro = "ljchuello";
// CLiente
AmazonLambdaClient lambdaClient = new AmazonLambdaClient("AccesKey", "SecretKey", RegionEndpoint.USEast1);
// Contecto
InvokeRequest invokeRequest = new InvokeRequest
{
FunctionName = "Test_Lambda",
@ljchuello
ljchuello / get-memory-netcore-linux.cs
Created December 22, 2022 12:42
Get Memory .NET Core Linux
using System.Diagnostics;
namespace Prueba
{
internal class Program
{
public class MemoryMetrics
{
public double Total;
public double Used;
@ljchuello
ljchuello / get-networks.cs
Created December 22, 2022 13:26
Get networks
using System.Diagnostics;
using System.Net.NetworkInformation;
namespace Prueba
{
internal class Program
{
static void Main(string[] args)
{
@ljchuello
ljchuello / netcore.sh
Last active August 3, 2023 02:51
Install the latest version of NET Core LTS on Linux operating systems
wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh
chmod +x ./dotnet-install.sh
./dotnet-install.sh --channel LTS
export DOTNET_ROOT=$HOME/.dotnet
export PATH=$PATH:$HOME/.dotnet:$HOME/.dotnet/tools
@ljchuello
ljchuello / ssh.net.cs
Created September 11, 2023 22:17
Método para conectarse desde C# a un terminal SSH en Linux utilizando llave privada
// Leemos la llave
string ssh = await File.ReadAllTextAsync(@"C:\UbicacionDeLaLlave\llave.ppk");
// Pasamos a MemoryStream
MemoryStream keyStream = new MemoryStream(Encoding.UTF8.GetBytes(ssh));
// Establecemos la conexión
ConnectionInfo connectionInfo = new ConnectionInfo("host", "Usuario | Suele ser root", new PrivateKeyAuthenticationMethod("root", new PrivateKeyFile(keyStream)));
// Entablamos la conexion