Skip to content

Instantly share code, notes, and snippets.

View placecodex's full-sized avatar

Maicol Romero placecodex

  • Dominican Republic
View GitHub Profile
@Linch1
Linch1 / tokenPriceApi.js
Last active November 3, 2024 21:17
Retrive the price of any bsc token from it's address without using external service like poocoin/dextools
let pancakeSwapAbi = [
{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"}],"name":"getAmountsOut","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},
];
let tokenAbi = [
{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},
];
const Web3 = require('web3');
/*
Required Node.js
@mahdiidarabi
mahdiidarabi / multi-send-smart-contract
Last active October 10, 2024 16:50
this is a smart contract with solidity to implement multi send transactions on ethereum
pragma solidity >=0.7.0 <0.9.0;
contract MultiSend {
// to save the owner of the contract in construction
address private owner;
// to save the amount of ethers in the smart-contract
uint total_value;
@placecodex
placecodex / bitcoin_address_generator.js
Last active December 1, 2020 23:09
generate bitcoin address testnet o main
const bitcoin = require('bitcoinjs-lib');
const TestNet = bitcoin.networks.testnet;
let keyPair = bitcoin.ECPair.makeRandom({ network: TestNet });//testnet
//var keyPair = bitcoin.ECPair.makeRandom();//main
var publicKey = keyPair.publicKey
var { address } = bitcoin.payments.p2pkh({ pubkey: publicKey });
var privateKey = keyPair.toWIF();
console.log(address)
@andelf
andelf / trc20.js
Created April 20, 2020 07:12
Get TRC20 balance and transfer USDT tokens
const TronWeb = require('tronweb');
const HttpProvider = TronWeb.providers.HttpProvider;
const fullNode = new HttpProvider("https://api.trongrid.io");
// const fullNode = new HttpProvider("http://192.168.1.162:8090");
const solidityNode = new HttpProvider("https://api.trongrid.io");
const eventServer = new HttpProvider("https://api.trongrid.io");
const privateKey = "3481E79956D4BD95F358AC96D151C976392FC4E3FC132F78A847906DE588C145";
const tronWeb = new TronWeb(fullNode, solidityNode, eventServer, privateKey);
@earth774
earth774 / Controller.php
Created March 12, 2019 05:07
create upload image in lumen
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Laravel\Lumen\Routing\Controller as BaseController;
class Controller extends BaseController
{
public function uploadImage(Request $request)
@jeffochoa
jeffochoa / Response.php
Last active November 13, 2024 14:18
Laravel HTTP status code
<?php
// This can be found in the Symfony\Component\HttpFoundation\Response class
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
@technoknol
technoknol / users_migration_and_database_seeder.php
Created April 20, 2017 09:18
Lumen 5.4/Laravel 5.4 Users migration and database Seeder
<?php
// Migration file
// database\migrations\create_users_table.php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
@vlucas
vlucas / encryption.js
Last active November 15, 2024 01:39
Stronger Encryption and Decryption in Node.js
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv);
@yickson
yickson / email.php
Last active August 29, 2020 22:06
KumbiaPHP-Email
<?php
class Email {
/**
* Realiza el envio del correo.
*
* @param $destino correo receptor
*/
public static function enviar($destino){
@kongondo
kongondo / remote-file-copy.php
Created January 14, 2016 13:01
Remote file copying with progress reporting in PHP.
<?php
/*
* Remote File Copy PHP Script 2.0.0
*
* Copyright 2012, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/