Skip to content

Instantly share code, notes, and snippets.

View fukaoi's full-sized avatar
:octocat:
deep dive in codes

fukaoi fukaoi

:octocat:
deep dive in codes
View GitHub Profile
@fukaoi
fukaoi / mint-cnft.ts
Last active December 20, 2023 11:31
Mint a cNFT using the solana suite
import { Airdrop } from '@solana-suite/airdrop';
import {
Account,
CompressedNft,
Explorer,
sleep,
} from '@solana-suite/compressed-nft';
(async () => {
const owner = Account.Keypair.create();
@fukaoi
fukaoi / memo-example.ts
Created June 25, 2022 15:53
Solana memo example via solana-suite(https://github.com/atonoy/solana-suite)
import {Account, Memo} from '@solana-suite/core';
(async () => {
const owner = Account.create();
await Account.requestAirdrop(owner.toPublicKey());
const sig = await Memo.create(
'solana suite memo test',
owner.toPublicKey(),
import {Wallet} from "./src/";
(() => {
console.log("start");
const starttime = Date.now();
let arr = [];
while (true) {
arr.push(Wallet.create());
if (arr.length == 500) {
console.log(`${(Date.now() - starttime) / 1000}/sec`);
@fukaoi
fukaoi / fetchTokenURI.js
Created April 20, 2021 04:10
fetch token url from smart contract at NFT toreka (NTX)
const Web3 = require('web3');
const web3 = new Web3('https://mainnet.infura.io/v3/1835809e0e6a4de38eaf1f7afb51e0ec');
const contractAddress = '0x34047D5d7F4C906998e0d9Def0d2Dc3B523d8398';
const abi = [
{
"constant": true,
"inputs": [
{
@fukaoi
fukaoi / memo-exmaple.js
Last active July 24, 2022 22:54
solana-program-library-memo
const {
Keypair,
Transaction,
TransactionInstruction,
PublicKey,
Connection,
sendAndConfirmTransaction,
LAMPORTS_PER_SOL,
} = require("@solana/web3.js");
@fukaoi
fukaoi / Dockerfile
Created January 17, 2021 14:21
Docker for crystal-nodejs
FROM ubuntu:20.04 as builder
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install curl gnupg make g++ -y
RUN curl -sL "https://keybase.io/crystal/pgp_keys.asc" | apt-key add -
RUN echo "deb https://dist.crystal-lang.org/apt crystal main" | tee /etc/apt/sources.list.d/crystal.list
RUN apt-get update
@fukaoi
fukaoi / stellar-activate-example.js
Last active June 19, 2020 06:21
To activate account when create stellar account on local pc
const StellarSdk = require('stellar-sdk');
const server = new StellarSdk.Server('https://horizon-testnet.stellar.org');
const pubkey = 'GC5OTOME3BSLOSH46OZ64HMIOKLKFSS2PQ5ULFD4J6LLFS7IHZQT4O76';
const secret = 'SBY37VIOJ7PN7LQBBPMTFTPIQXKHQW5X3RQQFMDXU2SUPQAYAHK5FJYU';
const destination = '';
(async () => {
const account = await server.loadAccount(pubkey);
const fee = await server.fetchBaseFee();
const timeout = await server.fetchTimebounds(10);
import React, {useState, useEffect} from 'react';
import {of, observable, interval} from 'rxjs';
import {map} from 'rxjs/operators';
import {ajax} from 'rxjs/ajax';
import './App.css';
const api = `https://randomuser.me/api/?results=5&seed=rx-react&nat=us&inc=name&noinfo`;
const getName = user => `${user.name.first} ${user.name.last}`;
@fukaoi
fukaoi / receive.cr
Created April 23, 2019 12:51
node.js to crystal named pipe
require "io"
require "json"
io = IO::Memory.new
Process.run("cat ~/Work/hogepipe", shell: true, output: io)
p data = io.to_s.chomp
p JSON.parse(data)["name"]
@fukaoi
fukaoi / send.js
Created April 23, 2019 12:50
node.js to crystal named pipe
const exec = require('child_process').exec;
var obj = {
"name":"太郎",
"age": 30,
"area":"Tokyo"
}
const json = JSON.stringify(JSON.stringify( obj ));
console.log(json)