Skip to content

Instantly share code, notes, and snippets.

View placecodex's full-sized avatar

Maicol Romero placecodex

  • Dominican Republic
View GitHub Profile
@placecodex
placecodex / remote-file-copy.php
Created September 26, 2019 20:44 — forked from kongondo/remote-file-copy.php
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
*/
@placecodex
placecodex / curl_progress.php
Created September 28, 2019 02:12 — forked from stuudmuffin/curl_progress.php
PHP/cURL download progress monitoring
<?php
//output buffer
ob_start();
//create javascript progress bar
echo '<html><head>
<script type="text/javascript">
function updateProgress(percentage) {
document.getElementById(\'progress\').value = percentage;
}
@placecodex
placecodex / ethereum_token_ERC20_transaction.js
Created November 14, 2020 21:33
ethereum token transaction
// Dotenv javascript libraries needed
require('dotenv').config();
// Ethereum javascript libraries needed
var Web3 = require('web3');
var Tx = require('ethereumjs-tx');
// Rather than using a local copy of geth, interact with the ethereum blockchain via infura.io
// The key for infura.io is in .env
const web3 = new Web3(Web3.givenProvider || "https://ropsten.infura.io/" + process.env["INFURA_KEY"])
// Fixed-point notation for number of MFIL which is divisible to 3 decimal places
function financialMfil(numMfil) {
@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)
@placecodex
placecodex / Database
Created February 15, 2021 22:16 — forked from sabid/Database
Laravel + Jquery Ajax Country and City
CREATE TABLE `paises` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
CREATE TABLE `ciudades` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pais_id` int(11) DEFAULT NULL,
`nombre` varchar(50) DEFAULT NULL,
@placecodex
placecodex / IndexController.php
Created February 18, 2021 21:01 — forked from juyal-ahmed/IndexController.php
Curl get request in Laravel controller with cache support.
<?php
namespace App\Http\Controllers;
class InfoController extends Controller
{
/*
*
* Checking if cache file exist
* @ param string $name cache file name
@placecodex
placecodex / index.php
Created February 18, 2021 22:13
obtener porcentaje de ganancia o perdida entre dos cantidades
public function obtenerPorcentaje($cantidad, $total) {
$porcentaje = ((float)$cantidad * 100) / $total; // Regla de tres
$porcentaje = round($porcentaje, 0); // Quitar los decimales
return $porcentaje;
}
@placecodex
placecodex / get_ethBalance.php
Last active September 5, 2021 00:30
get balance ethereum php , guzzle, curl
try {
$url ='https://api.anyblock.tools/ethereum/ethereum/ropsten/rpc/ac-a196sasasd581576f/';
$client = new Https();
$opts = [
@placecodex
placecodex / docker-compose.yml
Created March 24, 2021 22:46
Nginx Proxy Manager restart: always
version: '3'
services:
app:
image: 'jc21/nginx-proxy-manager:latest'
restart: always
ports:
- '80:80'
- '81:81'
- '443:443'
environment:
@placecodex
placecodex / footer.html
Last active April 2, 2021 16:59
Footer at bottom