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 / static_ip_ubuntu.text
Created April 1, 2021 13:27
put static ip v4 ubuntu
sudo nano /etc/netplan/00-installer-config.yaml
# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
@placecodex
placecodex / duckdns.text
Created April 2, 2021 16:59
how make docker image duckdns updater
sudo docker create \
--name=duckdns \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Europe/Madrid \
-e SUBDOMAINS=ejemplo1,ejemplo2 \
-e TOKEN=TOKEN HERE \
--restart unless-stopped \
linuxserver/duckdns
@placecodex
placecodex / bitcoin_to_satoshi.php
Last active April 11, 2021 23:18
bitcoin to satoshi php conversor
$btc = 0.00005; // amount
echo ($btc)*(pow(10, 8)); // bitcoin to satoshi
@placecodex
placecodex / satoshi_to_bitcoin.php
Created April 11, 2021 23:17
satoshi to bitcoin format php
$satoshi = 5000; //Satoshi to btc
echo number_format(($satoshi)*(pow(10, -8)), 8, '.', ''); //Returns 0.00005000
@placecodex
placecodex / gist:9e97e15a8cf8b789efc88c6bd5d58b74
Created April 15, 2021 20:57
generate ethereum account, wallet, address
npm i ethereumjs-wallet@0.6.3
var Wallet = require('ethereumjs-wallet');
const EthWallet = Wallet.generate();
console.log("address: " + EthWallet.getAddressString());
console.log("privateKey: " + EthWallet.getPrivateKeyString());
@placecodex
placecodex / aes_enc_dec.php
Created May 12, 2021 01:23 — forked from turret-io/aes_enc_dec.php
AES encryption/decryption in PHP
<?php
// DEFINE our cipher
define('AES_256_CBC', 'aes-256-cbc');
// Generate a 256-bit encryption key
// This should be stored somewhere instead of recreating it each time
$encryption_key = openssl_random_pseudo_bytes(32);
// Generate an initialization vector
// This *MUST* be available for decryption as well
@placecodex
placecodex / index.php
Created May 20, 2021 17:04
bitcoin transaction php testnet
use BitWasp\Bitcoin\Bitcoin;
use BitWasp\Bitcoin\Key\Factory\PrivateKeyFactory;
use BitWasp\Bitcoin\Script\P2shScript;
use BitWasp\Bitcoin\Script\WitnessScript;
use BitWasp\Bitcoin\Script\ScriptFactory;
use BitWasp\Bitcoin\Transaction\Factory\Signer;
use BitWasp\Bitcoin\Transaction\Factory\TxBuilder;
use BitWasp\Bitcoin\Transaction\OutPoint;
use BitWasp\Bitcoin\Transaction\TransactionOutput;
use BitWasp\Buffertools\Buffer;
@placecodex
placecodex / Response.php
Created February 8, 2022 15:01 — forked from jeffochoa/Response.php
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;
@placecodex
placecodex / trc20.js
Created March 18, 2022 16:31 — forked from andelf/trc20.js
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);
@placecodex
placecodex / route.php
Created March 28, 2022 15:41
protect files in laravel with router middleware
Route::get('/storage/uploads/{filename}', function ($filename)
{
$path = storage_path('app/public/uploads/images/' .'/'. $filename);
if (!File::exists($path)) {
$path = storage_path('app/public/uploads/' . 'NoImg.jpeg');
}
return Image::make($path)->response();