Skip to content

Instantly share code, notes, and snippets.

View giansalex's full-sized avatar

Giancarlos Salas giansalex

View GitHub Profile
@giansalex
giansalex / listen-cw20-transfer.go
Last active June 24, 2022 08:50
Listen cw20 transactions (Cosmwasm v1)
package main
import (
"context"
"fmt"
"log"
"time"
rpchttp "github.com/tendermint/tendermint/rpc/client/http"
)
@giansalex
giansalex / bank-transfer-shortlink.md
Last active May 25, 2022 05:13
Bank transfer proposal
@giansalex
giansalex / query-ruc-padron.php
Last active April 30, 2022 23:12
Query RUC list - SUNAT
<?php
// Descargar padron reducido: https://www.sunat.gob.pe/descargaPRR/mrc137_padron_reducido.html
// Resultado al descomprimir: padron_reducido_ruc.txt
set_time_limit(0);
function queryRucPadron($txtPath, $ruc)
{
$handle = fopen($txtPath, "r") or die("No se puede abrir el txt");
@giansalex
giansalex / sync_juno_from_genesis.md
Created April 21, 2022 20:47 — forked from webmaster128/sync_juno_from_genesis.md
Sync Juno from genesis (April 7th, 2022)

Run juno node from genesis

Base installation

Tested on Ubuntu 20.04 but should be very similar for all Ubuntu/Debian systems. Logged in as root because I'm feeling lucky.

# Base installation
apt update && apt upgrade -y \
  && apt install -y joe git build-essential jq screen
@giansalex
giansalex / eth-sign.js
Last active April 21, 2022 02:27
Ethereum - Sign arbitrary data (sign cosmos tx bytes)
var Web3 = require('web3');
var web3 = new Web3(window.web3.currentProvider);
var accountToSignWith = '0xbedcf417ff2752d996d2ade98b97a6f0bef4beb9';
var message = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Tubulum fuisse, qua illum, cuius is condemnatus est rogatione, P. Eaedem res maneant alio modo.'
function signHandler(err, signature) {
if (!err) {
console.log('Signature:', signature);
signature = signature.substr(2);
@giansalex
giansalex / mint-collection-nft.md
Last active April 21, 2022 02:25
Minting gno NFTs

Create collection

# args(2): name, symbol.
./build/gnokey maketx call test1 --pkgpath "gno.land/r/legend" --func CreateCollection \
  --args "Disperze NFTs" \
  --args "DNFT" \
  --gas-fee 1gnot --gas-wanted 2000000 > create.unsigned.txt

./build/gnokey sign test1 --txpath create.unsigned.txt --chainid "testchain" --number $ACC_NUMBER --sequence $SEQUENCE > create.signed.txt
./build/gnokey broadcast create.signed.txt --remote gno.land:36657
@giansalex
giansalex / docker-volume-directory.md
Created April 14, 2020 22:49
Docker volume in specify path (Linux)

Create docker volume

Create new docker volume in specific path.

Create Directory to save volume data

mkdir -p /mnt/xxxx/volume/data

Create volume with above path

@giansalex
giansalex / juno-state-sync.md
Last active November 29, 2021 17:53
Join to Juno UNI Testnet [state-sync]

Juno Cosmwasm state-sync

Build binary

git clone https://github.com/disperze/Juno
cd Juno
git checkout v2.0.0-beta-sync.3
make build && make install
@giansalex
giansalex / read-file-postgresql.md
Created January 13, 2018 18:59
Read file and insert data to field - PostgreSQL

First

Create function

create or replace function bytea_import(p_path text, p_result out bytea) 
                   language plpgsql as $$
declare
  l_oid oid;
  r record;
begin
 p_result := '';
@giansalex
giansalex / juno-lucina-testnet.md
Last active August 23, 2021 00:40
Join to JUNO chain testnet (lucina)

Join to Juno testnet

Initialize junod

junod init [moniker] --chain-id lucina

Configure junod

  • Download and replace the lucina Testnet genesis.json by: